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