Module: ActiveModel::Validations::HelperMethods

Defined in:
lib/validators/phony_validator.rb

Instance Method Summary collapse

Instance Method Details

#validates_plausible_phone(*attr_names) ⇒ Object



58
59
60
61
62
63
64
65
# File 'lib/validators/phony_validator.rb', line 58

def validates_plausible_phone(*attr_names)
  # merged attributes are modified somewhere, so we are cloning them for each validator
  merged_attributes = _merge_attributes(attr_names)

  validates_with PresenceValidator, merged_attributes.dup if merged_attributes[:presence]
  validates_with FormatValidator, merged_attributes.dup if merged_attributes[:with] || merged_attributes[:without]
  validates_with PhonyPlausibleValidator, merged_attributes.dup
end