changes from comments, fix commercials failing test
This commit is contained in:
parent
d794593e10
commit
beb88b848d
15 changed files with 58 additions and 77 deletions
|
|
@ -1,7 +1,7 @@
|
|||
module Admin
|
||||
class CommercialsController < ApplicationController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource through: :conference
|
||||
load_and_authorize_resource through: :conference, except: [:new, :create]
|
||||
|
||||
def index
|
||||
@commercials = @conference.commercials
|
||||
|
|
@ -9,12 +9,14 @@ module Admin
|
|||
|
||||
def new
|
||||
@commercial = @conference.commercials.build
|
||||
authorize! :create, @commercial
|
||||
end
|
||||
|
||||
def edit; end
|
||||
|
||||
def create
|
||||
@commercial = @conference.commercials.build(commercial_params)
|
||||
authorize! :create, @commercial
|
||||
|
||||
if @commercial.save
|
||||
redirect_to admin_conference_commercials_path,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue