I want to combine a selection of data from two tables and display it as
list. Note that this isn’t a join.
i’m looking for something like this:
Table 1: Sheep
Name, Age, Farmer, etc. (sheep specific columns)
Table 2: Cows:
Name, Age, Farmer, etc. (cow specific columns)
For my display I nneed something like this:
Farmer Jone’s Livestock:
TYPE NAME AGE
Cow Bessie 2
Sheep Fred 6
What’s the best way to do this in rails? I considered creating a view in
db and doing it there, as well as doing selects from both tables and
combining the results in a controller. I think I can just dump them all
one array since they answer the same messages.
Then, just as I was about to implement, I thought “There must be a
way’ to do this.” Is there?