Group records by both month and year in Rails

后端 未结 5 1291
走了就别回头了
走了就别回头了 2021-02-07 09:28

I\'m on Ruby 1.9.2, Rails 3.0.x and I use MySQL DB. I have a Messages Model, where one can post new messages every day.

I have an index action where I want to display t

5条回答
  •  长发绾君心
    2021-02-07 09:51

    Use Group Date.

    It supports time zones, so if you ever need to - the code will easily evolve.

    https://github.com/ankane/groupdate

提交回复
热议问题