Skip to content

Instantly share code, notes, and snippets.

@knewter
Forked from rthbound/work.rb
Created January 12, 2012 17:24
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 knewter/1601868 to your computer and use it in GitHub Desktop.
Save knewter/1601868 to your computer and use it in GitHub Desktop.
Hot products
PartNumber.ordered_between(7.days.ago, Time.zone.now)
class PartNumber
named_scope :ordered_between, lambda{|start_time, end_time| { :conditions => ["orders.created_at BETWEEN ? AND ?", start_time, end_time], :include => [:order] }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment