Skip to content

Instantly share code, notes, and snippets.

@jgarber
Created November 15, 2011 17:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarber/1367789 to your computer and use it in GitHub Desktop.
Save jgarber/1367789 to your computer and use it in GitHub Desktop.
Fetching most popular items in the last seven days using charlotte-ruby/impressionist
Impression.where("created_at>=? and created_at<=?",7.days.ago,Time.now).select("impressionable_id").group("impressionable_id").order("count_impressionable_id DESC").limit(7).count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment