One of the reasons they are able to adapt so easily to various environments is because they are opportunistic eaters who will eat whatever is available to them. They are known to omnivores that will feed on carcasses, fruit, vegetables, and everything in between. Certain species are known to prefer certain things, but they are not limited by those preferences. For example, Norway rats have a tendency to like high protein foods such as pet food and old scraps of meat. Roof rats, another common species that people encounter, often prefer fruit and can be attracted to areas with available fruit trees.
Their ability to adapt to human environments makes a lot of different food sources available to them. They will go inside homes, gardens, garbage cans, and in pet food bowls in order to find food. It is not beyond the nature of rats to cannibalize the carcasses of other dead rats as well. It is best for homeowners to limit their options in order to keep them from coming in or around their home. Locking up garbage cans and dumpsters and storing pet food inside are some things that homeowners can do to be proactive against a rat problem. Pest control professionals can assist a homeowner in understanding all the different ways they can limit their options.