module SubdomainLocale::Controller

Public Class Methods

included(base) click to toggle source
# File lib/subdomain_locale/controller.rb, line 3
def self.included(base)
  base.around_action :set_locale
end

Private Instance Methods

set_locale() { || ... } click to toggle source
# File lib/subdomain_locale/controller.rb, line 9
def set_locale
  locale = SubdomainLocale.mapping.locale_for(request.subdomain)
  locale = SubdomainLocale.default_fallback(locale)
  I18n.with_locale(locale) { yield }
end