Module: ActiveModel::Validations::HelperMethods

Defined in:
lib/validates_timeliness/helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#timeliness_validation_for(attr_names, type = nil) ⇒ Object



21
22
23
24
25
# File 'lib/validates_timeliness/helper_methods.rb', line 21

def timeliness_validation_for(attr_names, type=nil)
  options = _merge_attributes(attr_names)
  options.update(type: type) if type
  validates_with TimelinessValidator, options
end

#validates_date(*attr_names) ⇒ Object



5
6
7
# File 'lib/validates_timeliness/helper_methods.rb', line 5

def validates_date(*attr_names)
  timeliness_validation_for attr_names, :date
end

#validates_datetime(*attr_names) ⇒ Object



13
14
15
# File 'lib/validates_timeliness/helper_methods.rb', line 13

def validates_datetime(*attr_names)
  timeliness_validation_for attr_names, :datetime
end

#validates_time(*attr_names) ⇒ Object



9
10
11
# File 'lib/validates_timeliness/helper_methods.rb', line 9

def validates_time(*attr_names)
  timeliness_validation_for attr_names, :time
end

#validates_timeliness_of(*attr_names) ⇒ Object



17
18
19
# File 'lib/validates_timeliness/helper_methods.rb', line 17

def validates_timeliness_of(*attr_names)
  timeliness_validation_for attr_names
end