Rats show up when your citrus, tomato, or fruit first starts to ripen. Rats are agile climbers and usually live and nest in shrubs, trees, and dense ground cover like ivy. One management strategy is to prevent access to the tree by cutting branches away from fences or other trees, leaving a gap of at least 2–3 feet, good sanitation is required. Garbage and garden debris should be eliminated. Use tight-fitting lids on garbage cans. Thin out dense vegetation to make the habitat less desirable. Mow ivy once a year to the ground. Climbing ivies on fences or buildings should be removed.
Per the UC pest note (linked below), trapping is the safest and easiest method for controlling rats. Read the pest note for other management strategies as well.
More information: Rat Management