Exception: Ripple::DocumentInvalid

Inherits:
StandardError
  • Object
show all
Includes:
Translation
Defined in:
lib/ripple/validations.rb

Overview

Raised by save! when the document is invalid. Use the document method to retrieve the document which did not validate.

begin
  invalid_document.save!
rescue Ripple::DocumentInvalid => invalid
  puts invalid.document.errors
end

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Translation

#i18n_scope

Constructor Details

#initialize(document) ⇒ DocumentInvalid

Returns a new instance of DocumentInvalid.



17
18
19
20
21
# File 'lib/ripple/validations.rb', line 17

def initialize(document)
  @document = document
  errors = @document.errors.full_messages.join(", ")
  super(t("document_invalid", :errors => errors))
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



16
17
18
# File 'lib/ripple/validations.rb', line 16

def document
  @document
end