1
假设我有一个包含created_at,title和id的后期模型。我如何构建一个数组,使用year> months> posts来用于显示档案。如何在rails 3.2中创建类似档案的blogspot
到目前为止,我有:
@posts = Post.all(:order => 'created_at DESC')
@post_months = @posts.group_by { |t| t.created_at.beginning_of_month }
这让我有点像{ “2012年6月”=> { “POST1”, “POST2”}}这是接近。
http://shouweick.blogspot.co.uk/2012/02/handling-background-jobs-in-rails-32.html这里此博客的输出格式,我想{年=> {十一月=> {POST1,POST2},十二月=> {post3}}}
干杯,这就是发现。 – user1283644