I recommend watching this Railscast ( http://railscasts.com/episodes/202-active-record-queries-in-rails-3).. It helped me get a handle on AR 3's new query concept.
On Fri, Oct 8, 2010 at 1:57 PM, Christian Fazzini < [email protected]> wrote: > The following SQL: > > select * from medias m > left join artists a on a.id = m.artist_id > left join users u on u.id = a.user_id > left join genres g on g.id = u.genre_id > where g.name = 'Acoustic' > > is the equivalent to (which works): > > Video.find(:all, :conditions => ['genres.name = ?', > 'Acoustic'], :include => {:artist => {:user => :genre}}) > > However, I know that the rails 3 active record query uses the .where() > clause. How can I convert the above to something like: > > Song.where({:genre => 'Acoustic', :include => {:artist => {:user > => :genre}}}) <==== Does NOT work > > -- > 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]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- _________________________________ Joshua S. Martin -- 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.

