开发者

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'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜