module Daterange::ClassMethods

Public Instance Methods

active_at(time) click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 17
def active_at(time)
  where("(#{start_column} IS NULL OR #{start_column} <= :time) AND 
        (#{expire_column} IS NULL OR #{expire_column} > :time)",
        time: time)
end
active_now() click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 28
def active_now
  active_at(Time.now)
end
expire_column() click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 9
def expire_column
  daterange_config[:expire_column]
end
inactive_at(time) click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 23
def inactive_at(time)
  where("#{start_column} > :time OR #{expire_column} < :time",
        time: time)
end
inactive_now() click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 32
def inactive_now
  inactive_at(Time.now)
end
start_column() click to toggle source
# File lib/acts_as_daterange/daterange.rb, line 13
def start_column
  daterange_config[:start_column]
end