instance method
check_validity!
Ruby on Rails 3.1.12
Since v3.0.20 Last seen in v3.2.22.5Signature
check_validity!()
No documentation comment.
Source
# File activemodel/lib/active_model/validations/length.rb, line 22
def check_validity!
keys = CHECKS.keys & options.keys
if keys.empty?
raise ArgumentError, 'Range unspecified. Specify the :within, :maximum, :minimum, or :is option.'
end
keys.each do |key|
value = options[key]
unless value.is_a?(Integer) && value >= 0
raise ArgumentError, ":#{key} must be a nonnegative Integer"
end
end
end
Defined in activemodel/lib/active_model/validations/length.rb line 22
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations::LengthValidator