Here's the Rails2 request:
Foo.find_by_bar_and_baz('a-bar', 'a-baz', :select =>'count(*) as the_count' ).the_count.to_i
The query is ugly, but the resulting SQL is perfect.
Is there a more elegant way to do this in Rails 3 / Arel?
change
it's prettier, but still not Areca's magic:
Foo.count( :conditions => "bar = 'a-bar' and baz = 'a-baz'" )
source share