Use the host_name field to determine which conference to assign

This commit is contained in:
Petko Bordjukov 2015-08-15 06:15:53 +03:00
parent 70a5bbc27a
commit df4ffebd61
3 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,6 @@ class ApplicationController < ActionController::Base
#layout Proc.new { |controller| controller.request.host } #layout Proc.new { |controller| controller.request.host }
layout 'public/application' layout 'public/application'
def self.default_url_options(options={}) def self.default_url_options(options={})
if I18n.locale != I18n.default_locale if I18n.locale != I18n.default_locale
options.merge({locale: I18n.locale}) options.merge({locale: I18n.locale})

View File

@ -2,5 +2,9 @@ module Public
class ApplicationController < ::ApplicationController class ApplicationController < ::ApplicationController
include ::CurrentConferenceAssigning include ::CurrentConferenceAssigning
before_filter :require_current_conference! before_filter :require_current_conference!
def current_conference
@current_conference ||= Conference.order(created_at: :desc).find_by(host_name: request.host)
end
end end
end end

View File

@ -1,7 +1,7 @@
Rails.application.routes.draw do Rails.application.routes.draw do
devise_for :users devise_for :users
scope module: :public, constraints: {subdomain: 'cfp'}, conference_id: 1 do scope module: :public do
root to: 'home#index' root to: 'home#index'
resource :personal_profile, path: 'profile' resource :personal_profile, path: 'profile'
resources :events resources :events