Exception: Sequel::ValidationFailed
- Defined in:
- lib/sequel/model/exceptions.rb
Overview
Exception class raised when raise_on_save_failure
is set and validation fails
Constant Summary
Constants inherited from Error
Error::AdapterNotFound, Error::InvalidOperation, Error::InvalidValue, Error::PoolTimeoutError, Error::Rollback
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
The Sequel::Model::Errors object related to this exception.
-
#model ⇒ Object
readonly
The Sequel::Model object related to this exception.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(errors = nil) ⇒ ValidationFailed
constructor
A new instance of ValidationFailed.
Constructor Details
#initialize(errors = nil) ⇒ ValidationFailed
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/sequel/model/exceptions.rb', line 45 def initialize(errors=nil) if errors.is_a?(Sequel::Model) @model = errors errors = @model.errors end if errors.respond_to?(:full_messages) @errors = errors super(errors..join(', ')) else super end end |
Instance Attribute Details
#errors ⇒ Object (readonly)
The Sequel::Model::Errors object related to this exception.
43 44 45 |
# File 'lib/sequel/model/exceptions.rb', line 43 def errors @errors end |
#model ⇒ Object (readonly)
The Sequel::Model object related to this exception.
40 41 42 |
# File 'lib/sequel/model/exceptions.rb', line 40 def model @model end |