authorization with cancancan
This commit is contained in:
parent
4af0e59ca6
commit
c3ed57e3e9
34 changed files with 538 additions and 500 deletions
|
|
@ -1,16 +1,21 @@
|
|||
class Admin::SupportersController < ApplicationController
|
||||
before_filter :verify_organizer
|
||||
module Admin
|
||||
class Admin::SupportersController < ApplicationController
|
||||
load_and_authorize_resource :conference, find_by: :short_title
|
||||
load_and_authorize_resource :supporter, through: :conference
|
||||
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: DatatableSupporters.new(@conference.supporter_registrations, view_context) }
|
||||
def index
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.json { render json: DatatableSupporters.
|
||||
new(@conference.supporter_registrations, view_context) }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
params[:supporter_registration][:conference_id] = @conference.id
|
||||
supporter = SupporterRegistration.create!(params[:supporter_registration])
|
||||
redirect_to(admin_conference_supporters_path(conference_id: @conference.short_title),
|
||||
notice: 'Supporter added')
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
params[:supporter_registration][:conference_id] = @conference.id
|
||||
SupporterRegistration.create!(params[:supporter_registration])
|
||||
redirect_to(admin_conference_supporters_path(conference_id: @conference.short_title), notice: "Supporter added")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue