Tom Ha wrote:
> Hi there,
>
> In the model situation "Book :has_many Stories", I would like to do
> something like this:
>
> Book.find(:all, :conditions => { book.story.id => @story_ids })
>
> ...which of course doesn't work with "book.story.id =>..."
> (-> "undefined local variable or method 'book'")
>
> What's the correct query syntax for such a case (where I query across
> the 2 tables 'Books' and 'Stories')?
The magic you are looking for is :include
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---