Method: Admin::ResourceController#destroy

Defined in:
app/controllers/admin/resource_controller.rb

#destroyObject



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'app/controllers/admin/resource_controller.rb', line 61

def destroy
  invoke_callbacks(:destroy, :before)
  if @object.destroy
    invoke_callbacks(:destroy, :after)
    flash[:notice] = flash_message_for(@object, :successfully_removed)
    respond_with(@object) do |format|
      format.html { redirect_to collection_url }
      format.js   { render :partial => "/admin/shared/destroy" }
    end
  else
    invoke_callbacks(:destroy, :fails)
    respond_with(@object) do |format|
      format.html { redirect_to collection_url }
    end
  end
end