Method: ActiveModel::Validations::FormatValidator#validate_each
- Defined in:
- lib/active_model/validations/format.rb
#validate_each(record, attribute, value) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/active_model/validations/format.rb', line 10 def validate_each(record, attribute, value) if [:with] regexp = resolve_value(record, [:with]) record_error(record, attribute, :with, value) unless regexp.match?(value.to_s) elsif [:without] regexp = resolve_value(record, [:without]) record_error(record, attribute, :without, value) if regexp.match?(value.to_s) end end |