instance method
validate!
Ruby on Rails 4.2.9
Since v4.2.9 Last seen in v4.2.9Signature
validate!(context = nil)
Runs all the validations within the specified context. Returns true if no errors are found, raises RecordInvalid otherwise.
If the argument is false (default is nil), the context is set to :create if new_record? is true, and to :update if it is not.
Validations with no :on option will run no matter the context. Validations with some :on option will only run in the specified context.
Parameters
-
contextopt = nil
Source
# File activerecord/lib/active_record/validations.rb, line 72
def validate!(context = nil)
valid?(context) || raise_record_invalid
end
Defined in activerecord/lib/active_record/validations.rb line 72
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Validations