instance method
valid?
Ruby on Rails 3.2.22.5
Since v2.2.3Signature
valid?(context = nil)
Runs all the specified validations and returns true if no errors were added otherwise false. Context can optionally be supplied to define which callbacks to test against (the context is defined on the validations using :on).
Parameters
-
contextopt = nil
Source
# File activemodel/lib/active_model/validations.rb, line 192
def valid?(context = nil)
current_context, self.validation_context = validation_context, context
errors.clear
run_validations!
ensure
self.validation_context = current_context
end
Defined in activemodel/lib/active_model/validations.rb line 192
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Validations