Re: [Rails] How do I convert this active record query to a rails 3 query

2010-10-08 Thread Joshua Martin
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 < christian.fazz...@gmail.com> wrote: > The following SQL: > > select * from media

[Rails] How do I convert this active record query to a rails 3 query

2010-10-08 Thread Christian Fazzini
The following SQL: select * from videos v left join artists a on a.id = v.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'], :includ

[Rails] How do I convert this active record query to a rails 3 query

2010-10-08 Thread Christian Fazzini
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'], :includ