Module: Desponders::RestResponder

Defined in:
lib/desponders/rest_responder.rb

Instance Method Summary collapse

Instance Method Details

#to_formatObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/desponders/rest_responder.rb', line 3

def to_format
  case
  when get?
    display(resource, status: :ok)
  when has_errors?
    super
  when post?
    display(resource, status: :created)
  when put?
    display(resource, status: :ok)
  when delete?
    display({}, status: :no_content)
  end
end