Skip to content

Instantly share code, notes, and snippets.

@anathematic
Created July 24, 2012 05:40
Show Gist options
  • Save anathematic/3168247 to your computer and use it in GitHub Desktop.
Save anathematic/3168247 to your computer and use it in GitHub Desktop.
# orders.rb
scope :last_week, lambda { orders.where(purchased_at: 1.week.ago..Time.zone.now) }
# venue.rb
def timeline_summary
[["LW", :last_week], ["LM", :last_month], ["4M", :4_months]].collect do |value|
{ label: value[0]
value: self.orders.send(value[1]).count }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment