instance method
valid?
Ruby on Rails 3.0.20
Since v2.2.3Signature
valid?(context = nil)
Runs all the specified validations and returns true if no errors were added otherwise false.
Parameters
-
contextopt = nil
Source
# File activerecord/lib/active_record/validations.rb, line 53
def valid?(context = nil)
context ||= (new_record? ? :create : :update)
output = super(context)
deprecated_callback_method(:validate)
deprecated_callback_method(:"validate_on_#{context}")
errors.empty? && output
end
Defined in activerecord/lib/active_record/validations.rb line 53
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Validations