instance method
validate_each
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.2.22.5Signature
validate_each(record, attribute, value)
No documentation comment.
Parameters
-
recordreq -
attributereq -
valuereq
Source
# File activemodel/lib/active_model/validations/format.rb, line 6
def validate_each(record, attribute, value)
if options[:with] && value.to_s !~ options[:with]
record.errors.add(attribute, :invalid, options.except(:with).merge!(:value => value))
elsif options[:without] && value.to_s =~ options[:without]
record.errors.add(attribute, :invalid, options.except(:without).merge!(:value => value))
end
end
Defined in activemodel/lib/active_model/validations/format.rb line 6
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations::FormatValidator