group_by not working with rails3
I am using Rails 3.0.6
Keyword.create(:name => 'ror')
Keyword.create(:name => 'ror')
Keyword.create(:name => 'ruby')
开发者_如何学Python
I want to find popular search keywords.
I tried the followings but it did not work
>Keyword.group_by('keywords.name').order('count(keywords.id) desc')
undefined method `group_by' for #<Class:0x10278d748>
Try 'group' instead of 'group_by'
精彩评论