0
我有一個模型叫用戶創建的帖子。每篇文章都有一個created_at屬性。我想知道從開始日期到結束日期的每個日期第一次發佈的用戶數。如何通過第一個created_at進行分組?
我想要得到這樣一個結果:
1/1/2016: 15 posted for the first time
2/1/2016: 4 posted for the first time
3/1/2016: 0 posted for the first time
...
什麼是用ActiveRecord有效地做到這一點,最好的方法是什麼? :)
什麼數據庫你使用的是? –
你不能只使用created_at,它是一個時間戳,你將不得不使用範圍... – MageeWorld