views:

63

answers:

1

I have a tables Foo and Bar. Foo has one Bar. When I query Foo, how can I order it by a date column in the Bar table?

Thanks

+1  A: 
Foo.find(:all,:joins=>:boo, :order=>'bars.created_at DESC' )
khelll
thanks. is that "boo" a typo?
Fixed it + use :joins if u don't care for eager loading boo fields
khelll