Class: Common::Exceptions::SerializableError

Inherits:
Object
  • Object
show all
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

Instance Method Details

#detailObject



23
24
25
# File 'lib/common/exceptions/serializable_error.rb', line 23

def detail
  super || title
end

#to_hashObject

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