Class: Rack::Mongoid::Controllers::DestroyController

Inherits:
SingleResourceController show all
Defined in:
lib/rack/mongoid/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::Mongoid::Controllers::Base

Instance Method Details

#response_bodyObject



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

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

#response_statusObject



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

def response_status
  if resource
    200
  else
    404
  end
end