Keeping rats out of a vegetable or fruit garden can be challenging. If you have a serious rat problem, you can contact the Orange County Vector Control District
. There is a lot of information on this site, including what the Vector Control District will do and suggestions for what homeowners can do.
If your problem is not severe and you want to manage it yourself, you can use traps and/or baits. It is important to read through the information on management before you purchase control measures.
Read more about management of rats