From f4775f8e6ab31a05d83fafdb6eba7e025c7db826 Mon Sep 17 00:00:00 2001 From: shlok007 Date: Tue, 25 Jul 2017 07:42:50 +0530 Subject: [PATCH] fix access denied error for program in custom domains --- app/controllers/conferences_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index 15a59a0c..6e5dd5dd 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -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