Module: RestMyCase::AccusationAttorneys::HelperMethods

Included in:
Validator
Defined in:
lib/rest_my_case/accusation_attorneys/format.rb,
lib/rest_my_case/accusation_attorneys/length.rb,
lib/rest_my_case/accusation_attorneys/presence.rb,
lib/rest_my_case/accusation_attorneys/numericality.rb,
lib/rest_my_case/accusation_attorneys/helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#_merge_attributes(attr_names) ⇒ Object



6
7
8
9
10
11
# File 'lib/rest_my_case/accusation_attorneys/helper_methods.rb', line 6

def _merge_attributes(attr_names)
  options = Helpers.symbolyze_keys(Helpers.extract_options!(attr_names))
  attr_names.flatten!
  options[:attributes] = attr_names
  options
end

#validates_format_of(*attr_names) ⇒ Object



58
59
60
# File 'lib/rest_my_case/accusation_attorneys/format.rb', line 58

def validates_format_of(*attr_names)
  validates_with Format, _merge_attributes(attr_names)
end

#validates_length_of(*attr_names) ⇒ Object Also known as: validates_size_of



78
79
80
# File 'lib/rest_my_case/accusation_attorneys/length.rb', line 78

def validates_length_of(*attr_names)
  validates_with Length, _merge_attributes(attr_names)
end

#validates_numericality_of(*attr_names) ⇒ Object



88
89
90
# File 'lib/rest_my_case/accusation_attorneys/numericality.rb', line 88

def validates_numericality_of(*attr_names)
  validates_with Numericality, _merge_attributes(attr_names)
end

#validates_presence_of(*attr_names) ⇒ Object



15
16
17
# File 'lib/rest_my_case/accusation_attorneys/presence.rb', line 15

def validates_presence_of(*attr_names)
  validates_with Presence, _merge_attributes(attr_names)
end