Class: Hexagonal::Responses::CreateResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/hexagonal/responses/create_response.rb

Instance Method Summary collapse

Instance Method Details

#created_successfully(object) ⇒ Object



4
5
6
# File 'lib/hexagonal/responses/create_response.rb', line 4

def created_successfully(object)
  present object.class.to_s.underscore.to_sym, object
end

#creation_failed(exception) ⇒ Object



8
9
10
# File 'lib/hexagonal/responses/create_response.rb', line 8

def creation_failed(exception)
  error!({ errors: exception.record.errors }, 422)
end