Sha256: 1ee72f95bf43e2b01e9f4da80f48c511dadf0913f9a1d1fed83d3317f582e8b6
Contents?: true
Size: 888 Bytes
Versions: 18
Compression:
Stored size: 888 Bytes
Contents
class OrderView < ActiveRecord::Base self.table_name = 'order_view' self.primary_key = 'id' has_many :items, :foreign_key => 'order_id' default_scope :order => 'created_at DESC' scope :before, lambda { |time| where("created_at < ?", time) } scope :after, lambda { |time| where("created_at > ?", time) } scope :imported, where("fa_id IS NOT NULL") scope :not_imported, where("fa_id IS NULL") scope :artfully, where("transaction_id IS NOT NULL") set_watch_for :created_at, :local_to => :self, :as => :admins def artfully? !transaction_id.nil? end # # If we can push these into the view (with an SQL case) then we can save having to join to items in Ruby # def has_ticket? items.select(&:ticket?).present? end def has_donation? items.select(&:donation?).present? end def time_zone "Eastern Time (US & Canada)" end end
Version data entries
18 entries across 18 versions & 1 rubygems