OSDN Git Service

fix: fetch fail
[pettanr/pettanr.git] / app / controllers / authors_controller.rb
index e5e5c46..320d74e 100644 (file)
@@ -1,11 +1,11 @@
 class AuthorsController < ApplicationController
   if Manifest.manifest.magic_numbers['run_mode'] == 0
-    before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
-    before_filter :authenticate_author, :only => [:edit, :update]
+    before_action :authenticate_user, :only => [:new, :create, :edit, :update]
+    before_action :authenticate_author, :only => [:edit, :update]
   else
-    before_filter :authenticate_reader, :only => [:index, :show]
-    before_filter :authenticate_user, :only => [:new, :create, :edit, :update]
-    before_filter :authenticate_author, :only => [:edit, :update]
+    before_action :authenticate_reader, :only => [:index, :show]
+    before_action :authenticate_user, :only => [:new, :create, :edit, :update]
+    before_action :authenticate_author, :only => [:edit, :update]
   end
 
   def index
@@ -38,15 +38,22 @@ class AuthorsController < ApplicationController
     set_model
     @item = @my_model_class.new
     @item.supply_default 
-    @item.attributes = params[@my_model_class.item_name]
+    @item.attributes = @item.permit_params params
     @item.overwrite @operators
     render_create root_path
   end
   
   def update
     set_edit
-    @item.attributes = params[@my_model_class.item_name]
+    @item.attributes = @item.permit_params params
     @item.overwrite @operators
     render_update '/home/configure'
   end
+  
+  def destroy
+    set_model
+    @item = @my_model_class.edit(params[:id], @operators)
+    render_destroy '/home/configure'
+  end
+  
 end