Skip to content

Instantly share code, notes, and snippets.

@agoodman
Created August 25, 2011 16:44
Show Gist options
  • Save agoodman/1171119 to your computer and use it in GitHub Desktop.
Save agoodman/1171119 to your computer and use it in GitHub Desktop.
Determinging monthly activity
# this is really useful for collecting record counts into discrete buckets for visualization
(1..6).collect {|n| Query.where(['created_at > ?',Date.today-n.months]).where(['created_at < ?',Date.today-(n-1).months]).count}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment