clarion/app/controllers/management/management_controller.rb
Andrew Radev 752fc6262a Use @conference for current_conference if available
This means the top menu would work on the conferences#show page.
2015-07-26 14:39:50 +03:00

32 lines
710 B
Ruby

module Management
class ManagementController < ::ApplicationController
before_action :authenticate_user!, :authorize_user!
layout 'management'
private
def current_conference?
current_conference.present?
end
helper_method :current_conference?
def current_conference
if not @current_conference
if @conference
@current_conference = @conference
elsif params[:conference_id].present?
@current_conference = Conference.find(params[:conference_id])
end
end
@current_conference
end
helper_method :current_conference
def authorize_user!
head :forbidden unless current_user.admin?
end
end
end