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



54
55
56
# File 'lib/rest_my_case/accusation_attorneys/format.rb', line 54

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



74
75
76
# File 'lib/rest_my_case/accusation_attorneys/length.rb', line 74

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

#validates_numericality_of(*attr_names) ⇒ Object



84
85
86
# File 'lib/rest_my_case/accusation_attorneys/numericality.rb', line 84

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

#validates_presence_of(*attr_names) ⇒ Object



11
12
13
# File 'lib/rest_my_case/accusation_attorneys/presence.rb', line 11

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