module ActsAsDaterange
Constants
- VERSION
Public Instance Methods
acts_as_expirable(*args, start_date: nil, end_date: nil)
click to toggle source
set your own custom start_date and end_date acts_as_daterange :started_at, :ended_at or acts_as_daterange start_date: :started_at, end_date: :ended_at
# File lib/acts_as_daterange.rb, line 18 def acts_as_expirable(*args, start_date: nil, end_date: nil) include Daterange if args.present? if start_date || end_date || args.count != 2 raise ArgumentError.new("ActsAsDaterange: must have both start_date and end_date") end start_column,expire_column = args elsif start_date || end_date if !start_date || !end_date raise ArgumentError.new("ActsAsDaterange: must have both start_date and end_date") end start_column,expire_column = start_date, end_date end self.daterange_config = { start_column: start_column || 'start_date', expire_column: expire_column || 'end_date' } end