authorization with cancancan

This commit is contained in:
Stella Rouzi 2014-07-11 18:54:51 +03:00
parent 4af0e59ca6
commit c3ed57e3e9
34 changed files with 538 additions and 500 deletions

View file

@ -1,22 +1,25 @@
class Admin::TracksController < ApplicationController
before_filter :verify_organizer
module Admin
class TracksController < ApplicationController
load_and_authorize_resource :conference, find_by: :short_title
authorize_resource through: :conference
def show
respond_to do |format|
format.html { render :tracks_list }
format.json { render json: @conference.tracks.to_json }
def show
respond_to do |format|
format.html { render :tracks_list }
format.json { render json: @conference.tracks.to_json }
end
end
end
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_tracks_path(
conference_id: @conference.short_title),
notice: 'Tracks were successfully updated.')
else
redirect_to(admin_conference_tracks_path(
conference_id: @conference.short_title),
notice: 'Tracks update failed.')
def update
if @conference.update_attributes(params[:conference])
redirect_to(admin_conference_tracks_path(
conference_id: @conference.short_title),
notice: 'Tracks were successfully updated.')
else
redirect_to(admin_conference_tracks_path(
conference_id: @conference.short_title),
notice: 'Tracks update failed.')
end
end
end
end