OSDN Git Service

fix: op upload and destroy
[pettanr/pettanr.git] / app / controllers / stories_controller.rb
index 22a4b19..67ba22a 100644 (file)
@@ -87,18 +87,9 @@ class StoriesController < ApplicationController
   end
   
   def destroy
-    @item = Story.edit(params[:id], @operators)
-    respond_to do |format|
-      if @item.destroy_with_leafs
-        flash[:notice] = I18n.t('flash.notice.destroyed', :model => Story.model_name.human)
-        format.html { redirect_to '/home/stories' }
-        format.json { head :ok }
-      else
-        flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Story.model_name.human)
-        format.html { redirect_to @item }
-        format.json { render json: @item.errors, status: :unprocessable_entity }
-      end
-    end
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    render_destroy '/home/' + @item.path_name
   end
   
 end