Matthias von Rohr wrote:
My question, how can I say "Go and get me all the books whose person =
“Andy Griffith”. See what I mean? I want to search for a bunch of book
rows based on some value in the people table. How can I do that?
This assumes that your people database table has a column called “name”,
otherwise simple replace name by whatever your column is called (e.g
Or if you did split firstname/lastname in your database
Thanks for both responses. I put in a simpler example than I needed to
make it easier to explain. This is very good, but what if there are
several foreign keys for the books table. e.g. I want to do a search to
find all the books that where person from the people table = Andy
Griffith, publisher from the publishers table = Westinghouse, printer
from the printers table = Bob’s printing etc.
In other words, several conditions based of foreign keys at the same
time. Exactly like conditions works for the find method except with
foriegn keys. Am i reaching here?
The only other thing I can think of is to look up each foriegn key
individually and then put the id’s into the conidtion of books.find but
that seems to be working around the ORM. Of course, using like a search
engine is abusing it to begin with…
Is that more clear? Thanks again.