Exception: Recliner::DocumentInvalid
- Inherits:
-
DocumentNotSaved
- Object
- StandardError
- DocumentNotSaved
- Recliner::DocumentInvalid
- Defined in:
- lib/recliner/validations.rb
Overview
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 Recliner::DocumentInvalid => invalid
puts invalid.document.errors
end
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(document) ⇒ DocumentInvalid
constructor
A new instance of DocumentInvalid.
Constructor Details
#initialize(document) ⇒ DocumentInvalid
Returns a new instance of DocumentInvalid.
12 13 14 15 |
# File 'lib/recliner/validations.rb', line 12 def initialize(document) @document = document super("Validation failed: #{@document.errors..join(", ")}") end |
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
10 11 12 |
# File 'lib/recliner/validations.rb', line 10 def document @document end |