Created
June 11, 2013 16:43
-
-
Save lappi-lynx/5758489 to your computer and use it in GitHub Desktop.
Rails group_by_day method
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
# Method for grouping users by the day (for postgresql): | |
User.order("DATE(created_at)").group("DATE(created_at)").count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You don't need the order clause as active record will send this as SQL and that will sort all that for you