Created
August 13, 2018 01:14
-
-
Save SunDi3yansyah/c8a7e227e45c3ddf03049c340be31e08 to your computer and use it in GitHub Desktop.
Rails group by beginning_of
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Model.all.group_by { |value| value.created_at.beginning_of_week } | |
| Model.all.group_by { |value| value.created_at.beginning_of_month } | |
| Model.all.group_by { |value| value.created_at.beginning_of_year } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment