开发者

group_by not working with rails3

开发者 https://www.devze.com 2023-02-25 01:49 出处:网络
I am using Rails 3.0.6 Keyword.create(:name => \'ror\') Keyword.create(:name => \'ror\') Keyword.create(:name => \'ruby\')

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

精彩评论

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