Exception: CouchRest::Model::Errors::Validations

Inherits:
CouchRestModelError show all
Defined in:
lib/couchrest/model/errors.rb

Overview

Raised when a persisence method ending in ! fails validation. The message will contain the full error messages from the Document in question.

Example:

Validations.new(person.errors)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document) ⇒ Validations

Returns a new instance of Validations.



16
17
18
19
# File 'lib/couchrest/model/errors.rb', line 16

def initialize(document)
  @document = document
  super("Validation Failed: #{@document.errors.full_messages.join(", ")}")
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



15
16
17
# File 'lib/couchrest/model/errors.rb', line 15

def document
  @document
end