OSDN Git Service

fix: op upload and destroy
[pettanr/pettanr.git] / app / controllers / sheets_controller.rb
index 0132a9d..f0a1455 100644 (file)
@@ -138,17 +138,9 @@ class SheetsController < ApplicationController
   end
   
   def destroy
-    @sheet = Sheet.edit(params[:id], @operators)
-    respond_to do |format|
-      if @sheet.destroy_with_sheet_panel
-        flash[:notice] = I18n.t('flash.notice.destroyed', :model => Sheet.model_name.human)
-        format.html { redirect_to '/home/sheets' }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Sheet.model_name.human)
-        format.html { redirect_to @sheet }
-        format.json { render json: @sheet.errors, status: :unprocessable_entity }
-      end
-    end
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    render_destroy '/home/' + @item.path_name
   end
+  
 end