class ActiveModel::ValidationError
end
puts invalid.model.errors
rescue ActiveModel::ValidationError => invalid
complex_operation_that_internally_calls_validate!
beginmodel
method to retrieve the record which did not validate.
Raised by validate!
when the model is invalid. Use the
= Active Model ValidationError
def initialize(model)
def initialize(model) @model = model errors = @model.errors.full_messages.join(", ") super(I18n.t(:"#{@model.class.i18n_scope}.errors.messages.model_invalid", errors: errors, default: :"errors.messages.model_invalid")) end