Class: Rack::MongoidAdapter::Controllers::DestroyController

Inherits:
SingleResourceController show all
Defined in:
lib/rack/mongoid_adapter/controllers/destroy_controller.rb

Instance Attribute Summary

Attributes inherited from Base

#env

Instance Method Summary collapse

Methods inherited from Base

call, #call, #initialize

Constructor Details

This class inherits a constructor from Rack::MongoidAdapter::Controllers::Base

Instance Method Details

#response_bodyObject



13
14
15
16
17
18
19
20
# File 'lib/rack/mongoid_adapter/controllers/destroy_controller.rb', line 13

def response_body
  if resource
    connection.find(_id: id).remove
    JSON.pretty_generate(resource, pretty: true) + "\n"
  else
    response_body_for_not_found
  end
end

#response_statusObject



5
6
7
8
9
10
11
# File 'lib/rack/mongoid_adapter/controllers/destroy_controller.rb', line 5

def response_status
  if resource
    200
  else
    404
  end
end