Implement role authorization

This commit is contained in:
Stella Rouzi 2014-08-12 11:51:59 +03:00
parent 6755328c4c
commit e2fb434dc7
122 changed files with 1386 additions and 751 deletions

View file

@ -1,7 +1,7 @@
module Admin
class CommercialsController < ApplicationController
before_action :set_conference
before_action :set_commercial, only: [:edit, :update, :destroy]
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource through: :conference
def index
@commercials = @conference.commercials
@ -43,14 +43,6 @@ module Admin
private
def set_commercial
@commercial = @conference.commercials.find(params[:id])
end
def set_conference
@conference = Conference.find_by(short_title: params[:conference_id])
end
def commercial_params
#params.require(:commercial).permit(:commercial_id, :commercial_type)
params[:commercial]