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
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