Exception: Ripple::DocumentInvalid

Inherits:
StandardError
  • Object
show all
Includes:
Translation
Defined in:
ripple/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

Methods included from Riak::Util::Translation

#i18n_scope, #t

Constructor Details

- (DocumentInvalid) initialize(document)

A new instance of DocumentInvalid



31
32
33
34
35
# File 'ripple/lib/ripple/validations.rb', line 31

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

Instance Attribute Details

- (Object) document (readonly)

Returns the value of attribute document



30
31
32
# File 'ripple/lib/ripple/validations.rb', line 30

def document
  @document
end