From df4ffebd610bc7fc7a4d6c8c4d99b06888ed864f Mon Sep 17 00:00:00 2001 From: Petko Bordjukov Date: Sat, 15 Aug 2015 06:15:53 +0300 Subject: [PATCH] Use the host_name field to determine which conference to assign --- app/controllers/application_controller.rb | 1 - app/controllers/public/application_controller.rb | 4 ++++ config/routes.rb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 032d926..4a87bd1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -12,7 +12,6 @@ class ApplicationController < ActionController::Base #layout Proc.new { |controller| controller.request.host } layout 'public/application' - def self.default_url_options(options={}) if I18n.locale != I18n.default_locale options.merge({locale: I18n.locale}) diff --git a/app/controllers/public/application_controller.rb b/app/controllers/public/application_controller.rb index a1958df..47e7e3f 100644 --- a/app/controllers/public/application_controller.rb +++ b/app/controllers/public/application_controller.rb @@ -2,5 +2,9 @@ module Public class ApplicationController < ::ApplicationController include ::CurrentConferenceAssigning before_filter :require_current_conference! + + def current_conference + @current_conference ||= Conference.order(created_at: :desc).find_by(host_name: request.host) + end end end diff --git a/config/routes.rb b/config/routes.rb index e98b747..4e6d5b1 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,7 @@ Rails.application.routes.draw do devise_for :users - scope module: :public, constraints: {subdomain: 'cfp'}, conference_id: 1 do + scope module: :public do root to: 'home#index' resource :personal_profile, path: 'profile' resources :events