Sha256: df308a6a1beda37cc0d6d49c103f6dec392f698552ec5fc4199d773892da8675
Contents?: true
Size: 712 Bytes
Versions: 7
Compression:
Stored size: 712 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) } scope :by_user, -> (user) { where(user_id: user) } 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, id DESC') } end end end end
Version data entries
7 entries across 7 versions & 2 rubygems