Sha256: c014def254e0fe39436feb2296b13cf3b03392dc3758e9df2916fd7bd8bfa96d
Contents?: true
Size: 797 Bytes
Versions: 2
Compression:
Stored size: 797 Bytes
Contents
module Comable class Order < ActiveRecord::Base module Scopes extend ActiveSupport::Concern included do scope :complete, -> { where.not(completed_at: nil) } scope :incomplete, -> { where(completed_at: nil).where(draft: false) } scope :by_user, -> (user) { where(user_id: user) } scope :draft, -> { where(draft: true) } scope :this_month, -> { where(completed_at: Time.now.beginning_of_month..Time.now.end_of_month) } scope :this_week, -> { where(completed_at: Time.now.beginning_of_week..Time.now.end_of_week) } scope :last_week, -> { where(completed_at: 1.week.ago.beginning_of_week..1.week.ago.end_of_week) } scope :recent, -> { order('completed_at DESC, created_at DESC, id DESC') } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
comable-core-0.7.1 | app/models/comable/order/scopes.rb |
comable-core-0.7.0 | app/models/comable/order/scopes.rb |