defined ability for user with roles -organizer and cfp's, and some improvements in controller

This commit is contained in:
Shriyansh 2016-04-09 02:00:32 +05:30
parent 5cdedbf9a6
commit 3bcdbe7469
2 changed files with 5 additions and 11 deletions

View file

@ -1,9 +1,8 @@
module Admin
class VenueCommercialsController < Admin::BaseController
load_and_authorize_resource :conference, find_by: :short_title
load_and_authorize_resource :venue, through: :conference, singelton: true
before_action :set_venue
before_action :set_commercial, only: [:update, :destroy]
load_and_authorize_resource :venue, through: :conference, singleton: true
load_and_authorize_resource :commercial, through: :venue, singleton: true
def create
@commercial = @venue.build_commercial(commercial_params)
@ -50,13 +49,5 @@ module Admin
def commercial_params
params.require(:commercial).permit(:url)
end
def set_venue
@venue = @conference.venue
end
def set_commercial
@commercial = Commercial.find params[:id]
end
end
end