Class: Common::Exceptions::SerializableError
- Inherits:
-
Object
- Object
- Common::Exceptions::SerializableError
- Extended by:
- ActiveModel::Naming
- Includes:
- ActiveModel::Serialization
- Defined in:
- lib/common/exceptions/serializable_error.rb
Overview
This class is used to construct the JSON API SPEC errors object used for exceptions
Instance Method Summary collapse
- #detail ⇒ Object
-
#to_hash ⇒ Object
return only those attributes that have non nil values.
Instance Method Details
#detail ⇒ Object
23 24 25 |
# File 'lib/common/exceptions/serializable_error.rb', line 23 def detail super || title end |
#to_hash ⇒ Object
return only those attributes that have non nil values
28 29 30 |
# File 'lib/common/exceptions/serializable_error.rb', line 28 def to_hash attribute_set.map { |a| [a.name, send(a.name)] if send(a.name).present? }.compact.to_h end |