Class: NanoService::ErrorSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/nano-service/error_serializer.rb

Class Method Summary collapse

Class Method Details

.serialize(errors) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/nano-service/error_serializer.rb', line 3

def self.serialize(errors)
  if errors && errors.respond_to?(:to_hash) && errors.respond_to?(:full_messages)
    errors.to_hash.merge(full_messages: errors.try(:full_messages))
  else
    {}
  end
end