Method: ActiveModel::Validations#validate!
- Defined in:
- activemodel/lib/active_model/validations.rb
#validate!(context = nil) ⇒ Object
Runs all the validations within the specified context. Returns true
if no errors are found, raises ValidationError
otherwise.
Validations with no :on
option will run no matter the context. Validations with some :on
option will only run in the specified context.
411 412 413 |
# File 'activemodel/lib/active_model/validations.rb', line 411 def validate!(context = nil) valid?(context) || raise_validation_error end |