So, I learned today that in europe they didnt really trust the tomato in the beginning because it looked like another poisonous plant. So, i was wondering how early humans figured out what was edible and what wasnt? especially in places like south america where the tribes got so seperated. Im just hoping there is a better answer than "trial and error".
I can't provide any historical context, but very much of this is going to be based heavily on evolution and perception.
There is evidence that taste receptors for bitter foods evolved as a way to avoid alkaloids which are typically poisons and taste extremely bitter (to most people) and can be detected in surprisingly small amounts. Similarly taste and olfactory receptors for sour may have evolved as a way to avoid spoiled food. Avoiding bitter and sour foods is an innate response (although very often people will consume such foods as adults).
On the other side, sweet, fatty and salty flavors are almost universally preferred as they are easy to digest, nutritionally dense, or otherwise essential (salt). There is evidence that these perceptions are responsible for a lot of the nutritional and health problems in modern societies (sweet, fatty, and salty foods were relatively rare in our evolutionary history).
Here's a good article I found that summarizes a lot of the recent research and understanding, http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3342754/
I don't think saying Trial and Error is very far off, there are evolutionary cues that discourage us from eating foods that are bitter (because they're likely toxic) and sour (because they will likely contain large amounts of bacteria and their waste products) and encourage us eating foods that are nutritionally dense.