我怎麼能從軌道查詢紅寶石這個結果?紅寶石軌道:等效軌道查詢得到這個 - >
select post_id, count(post_id)
from comments
group by post_id
order by count(post_id) desc
limit 5
我怎麼能從軌道查詢紅寶石這個結果?紅寶石軌道:等效軌道查詢得到這個 - >
select post_id, count(post_id)
from comments
group by post_id
order by count(post_id) desc
limit 5
我建議你接受一些答案,然後看看這個指南http://guides.rubyonrails.org/active_record_querying.html – bassneck
我想得到那些帖子的評論最多限制5 – railshero