Figuring out what to eat is a big problem for rats, because they are omnivores and because they are widely and recently distributed over the globe.
Being an omnivore means that rats can exploit many different kids of food resources, which means rats can live in a wide variety of different environments. This is one of the reasons why rats have been so incredibly successful as a species. But being an omnivore also means that an individual has a lot of choices about what to eat, and this poses great risks: the wrong choice could be fatal.
Rats are widely distributed over the globe, and this distribution is a recent phenomenon. Despite their name, Norway rats originated in northern China. They hitched a ride with humans and spread along trade routes to colonize the globe in just the last few centuries. The rats' expansion is therefore extraordinarily recent from an evolutionary standpoint -- they haven't had time to specialize in their new local environments. A Norway rat born in a port in Nova Scotia is quite similar, genetically, to one born behind a restaurant in Berlin, in a sewer in Melbourne, or in an open market in Bangkok. But the food items these rats encounter in these locations will be very different from each other.
Every rat's environment is filled with many potential foods and with many non-foods: poisons (both natural and man-made), rocks, plastics and so forth. How does the rat figure out what to eat?
Learning what to eat happens in many phases, but follows the basic rule of thumb that "if someone else ate it, I can eat it too:"
Before birth: In utero, fetal rats detect odor-bearing particles that come from their mother's diet and cross the placental barrier. Shortly after birth, newborn rats respond positively to these foods (Hepper 1988). Therefore, they start learning about what to eat from their mother before they're even born.
During nursing: Nursing rats receive information about their mother's diet through her milk. They prefer the foods she ate during lactation (Bronstein et al.1975, Galef and Sherry 1973, Galef and Henderson 1972).
Weaning: When young rats are weaning and eating solid foods for the first time, they use adult rats as guides. They forage where the adults are foraging (Galef 1971, 1981; Galef and Clark 1971a, b) or where adults have previously scent-marked (Galef and Beck 1985, Galef and Heiber 1976, Laland and Plotkin 1991, 1993).
Adolescence and adulthood: when rats forage on their own, their food choices are influenced by social interactions that may take place far away from foraging sites. They smell foods on the fur, whiskers and especially the breath of other rats and strongly prefer the foods those rats had previously eaten (Galef and Wigmore 1983, Posadas-Andrews and Roper 1983). The relevant chemical cue may be carbon disulfide (CS2), which is present in rat breath. When rats are presented with foods swabbed with CS2 and non-swabbed foods, rats strongly prefer the food swabbed with CS2 (Galef, Mason, Preti and Bean 1988).
The principle of eating what others eat helps the rat identify potential foods and expand its feeding repertoire at low risk to itself. But this process is not entirely risk-free. Social learning does not help rats identify poisons: a rat still prefers the foods it smells on others' breaths even if the other rats are sick or dying (Galef, Whigmore and Kennett 1983; Galef, McQuoid and Whiskin 1990; Grover et al.1988)
(For literature reviews, see: Galef 1977, 1985b, 1988, 1994, and 1996).
Rats also learn what not to eat, and this is where poison avoidance comes in:
Neophobia: Rats are very neophobic when it comes to food: they tend to avoid new foods.
Learned food aversions: Rats have extremely sensitive learned food-aversions. If a rat does taste a new food it may try only a small amount the first time. If the food makes the rat feel ill, it scrupulously avoids that food in the future (Garcia and Koelling 1966).
Pica: If a rat does eat something that makes it feel nauseous, it cannot vomit (another reason for a rat to be very careful about what it puts down there). But it does have an alternative to vomiting, called "pica," which means the consumption of non-foods like clay (Mitchell 1976). When a rat feels ill is may eat clay, which may help dilute the toxin's effect on the body (Philips et al.1995, Philips 1999, Sarr et al. 1995).
Therefore rats are not "born" with a knowledge of safe foods and poisons. Instead, they have the ability to learn which items in their environment are safe to eat, and which are poisonous.