OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / controllers / comic_stories_controller.rb
index 54ac355..449dd21 100644 (file)
@@ -1,13 +1,13 @@
 class ComicStoriesController < ApplicationController
   if Manifest.manifest.magic_numbers['run_mode'] == 0
-    before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
-    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
+    before_action :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_action :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   else
-    before_filter :authenticate_reader, :only => [
+    before_action :authenticate_reader, :only => [
       :index, :show, :by_story, :by_comic, :by_author
     ]
-    before_filter :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
-    before_filter :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
+    before_action :authenticate_user, :only => [:new, :create, :edit, :update, :destroy]
+    before_action :authenticate_author, :only => [:new, :create, :edit, :update, :destroy]
   end
   
   def index
@@ -15,15 +15,15 @@ class ComicStoriesController < ApplicationController
   end
   
   def by_story
-    filer_list
+    filer_list param: params[:id]
   end
   
   def by_comic
-    filer_list
+    filer_list param: params[:id]
   end
   
   def by_author
-    filer_list
+    filer_list param: params[:id]
   end
   
   def show
@@ -50,7 +50,7 @@ class ComicStoriesController < ApplicationController
     set_model
     @item = @my_model_class.new
     @item.supply_default
-    @item.attributes = params[@item.item_name]
+    @item.attributes = @item.permit_params params
     @item.overwrite @operators
     @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
     @panel = @my_model_class.destination_model.show(@item.destination_id, @operators) if @item.destination_id
@@ -59,10 +59,10 @@ class ComicStoriesController < ApplicationController
   end
   
   def update
-    @my_model_class = self.class.model
+    set_model
     @item = @my_model_class.edit(params[:id], @operators)
     ot = @item.t
-    @item.attributes = params[@item.item_name]
+    @item.attributes = @item.permit_params params
     @item.overwrite @operators
     @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
     # no check permission for destination
@@ -76,7 +76,7 @@ class ComicStoriesController < ApplicationController
     set_model
     @item = @my_model_class.edit(params[:id], @operators)
     @binder = @my_model_class.binder_model.edit(@item.binder_id, @operators) if @item.binder_id
-    render_destroy '/home/' + play_comic_path(@item)
+    render_destroy play_comic_path(@binder)
   end
   
 end