Class: JSONAPI::Utils::Exceptions::ActiveRecord
- Inherits:
-
Exceptions::Error
- Object
- Exceptions::Error
- JSONAPI::Utils::Exceptions::ActiveRecord
- Defined in:
- lib/jsonapi/utils/exceptions.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(object) ⇒ ActiveRecord
constructor
A new instance of ActiveRecord.
Constructor Details
#initialize(object) ⇒ ActiveRecord
Returns a new instance of ActiveRecord.
9 10 11 |
# File 'lib/jsonapi/utils/exceptions.rb', line 9 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object
Returns the value of attribute object.
7 8 9 |
# File 'lib/jsonapi/utils/exceptions.rb', line 7 def object @object end |
Instance Method Details
#errors ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jsonapi/utils/exceptions.rb', line 13 def errors object.errors.keys.map do |key| JSONAPI::Error.new( code: JSONAPI::VALIDATION_ERROR, status: :unprocessable_entity, id: key, title: object.errors.(key).first ) end end |