class MongoModel::DocumentInvalid
Raised by save!
and create!
when the document is invalid. Use the document
method to retrieve the document which did not validate.
begin complex_operation_that_calls_save!_internally rescue MongoModel::DocumentInvalid => invalid puts invalid.document.errors end
Attributes
document[R]
Public Class Methods
new(document)
click to toggle source
Calls superclass method
# File lib/mongomodel/support/exceptions.rb, line 16 def initialize(document) @document = document errors = @document.errors.full_messages.join(I18n.t('support.array.words_connector', :default => ', ')) super(I18n.t('mongomodel.errors.messages.document_invalid', :errors => errors)) end