Module: RESTFramework::DestroyModelMixin

Included in:
ModelControllerMixin
Defined in:
lib/rest_framework/controllers/models.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



189
190
191
192
193
194
195
196
197
# File 'lib/rest_framework/controllers/models.rb', line 189

def destroy
  @record = self.get_record
  if @record
    @record.destroy!
    api_response('')
  else
    api_response({detail: "Method 'DELETE' not allowed."}, status: 405)
  end
end