class ActiveRecord::RecordInvalid
end
puts invalid.record.errors
rescue ActiveRecord::RecordInvalid => invalid
complex_operation_that_calls_save!_internally
beginrecord
method to retrieve the record which did not validate.
Raised by save!
and create!
when the record is invalid. Use the
def initialize(record)
def initialize(record) @record = record errors = @record.errors.full_messages.join(I18n.t('support.array.words_connector', :default => ', ')) super(I18n.t('activerecord.errors.messages.record_invalid', :errors => errors)) end