fix access denied error for program in custom domains

This commit is contained in:
shlok007 2017-07-25 07:42:50 +05:30 committed by Shlok Srivastava
parent 0ac5d18ef2
commit f4775f8e6a

View file

@ -2,7 +2,6 @@ class ConferencesController < ApplicationController
protect_from_forgery with: :null_session
before_action :respond_to_options
load_and_authorize_resource find_by: :short_title
load_resource :program, through: :conference, singleton: true, except: :index
def index
@current = Conference.where('end_date >= ?', Date.current).reorder(start_date: :asc)
@ -10,14 +9,15 @@ class ConferencesController < ApplicationController
end
def show
# have to change "localhost" to ENV['OSEM_HOSTNAME'] in production
# have to change "localhost" to ENV['OSEM_HOSTNAME'] in production
check_custom_domain if request.host != 'localhost'
@program = @conference.program
end
private
def check_custom_domain
@conference = @conference.custom_domain.present? ? Conference.find_by(custom_domain: request.domain) : @conference
@conference = @conference.nil? ? Conference.find_by(custom_domain: request.domain) : @conference
end
def respond_to_options