Sha256: a309eb23d71ca0151fe169d826eef086aabc742c6874eb3ad10da94e854ea369
Contents?: true
Size: 851 Bytes
Versions: 1
Compression:
Stored size: 851 Bytes
Contents
module Scopes def self.included(base) base.class_eval do def self.created_before(date) where("#{table_name}.created_at < ?", date) end def self.created_between(start_date, end_date) where("#{table_name}.created_at > ? AND #{table_name}.created_at < ?", start_date, end_date) end def self.created_after(date) where("#{table_name}.created_at > ?", date) end def self.updated_before(date) where("#{table_name}.updated_at < ?", date) end def self.updated_between(start_date, end_date) where("#{table_name}.updated_at > ? AND #{table_name}.updated_at < ?", start_date, end_date) end def self.updated_after(date) where("#{table_name}.updated_at > ?", date) end end end end ActiveRecord::Base.send(:include, Scopes)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
season-0.0.1 | lib/season/active_record/scopes.rb |