It's amazing, when you stop to think for a moment, how people have learned what's edible and what isn't. I suspect that back in our early history, we observed animals grazing and took a lesson from them. For the most part, animals will avoid toxic plants, unless there's nothing else available.
In some instances, though, plants that don't harm animals can harm humans. In this case, it was probably a hit or miss affair. "Go ahead, Harry, just take a small bite and we'll all stand around for several hours or a couple of days if necessary to see if you croak."
A case of this is the nightshade family (Solanaceae). It's a big, big family and includes well over 2,500 plants. Rabbits, goats, pigs, and sheep graze on these plants and don't seem to be affected by them. However, dogs or cats aren't immune.
Some of these plants are very familiar (tomatoes and potatoes) and others may be a bit unfamiliar to you (jimson weed and deadly nightshade - also known as belladonna).
To make matters more interesting, certain parts of the plant are edible and nutritious. We eat the fruit of the tomato plant and the tubers of the potato plant. The leaves, however, contain an alkaloid substance that is toxic. You may notice that your hands or arms itch after you've been working around tomato plants. Best to wear gloves and long sleeves to prevent this irritation.
Friday, a bit more on this topic, and why green taters aren't good for you.
10 hours ago