Sha256: 8010656eec0216ecdd7d23e3206cac6b3a3be5973256495d023188c837a6cfee

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

class InlineFormsApplicationController < ActionController::Base
  protect_from_forgery
  layout 'devise' if :devise_controller?
  
  # limit available locales by setting this. Override in applicaton_controller.
  I18n.available_locales = [ :en, :nl, :pp ]

  #set the locale based on the subdomain
  def set_locale
    I18n.locale = extract_locale_from_subdomain || I18n.default_locale

  end

  # Get locale code from request subdomain (like http://it.application.local:3000)
  def extract_locale_from_subdomain
    locale = request.subdomains.first
    return nil if locale.nil?
    I18n.available_locales.include?(locale.to_sym) ? locale.to_s : nil
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
inline_forms-1.3.12 lib/app/controllers/inline_forms_application_controller.rb
inline_forms-1.3.11 lib/app/controllers/inline_forms_application_controller.rb
inline_forms-1.3.10 lib/app/controllers/inline_forms_application_controller.rb
inline_forms-1.3.9 lib/app/controllers/inline_forms_application_controller.rb
inline_forms-1.3.8 lib/app/controllers/inline_forms_application_controller.rb
inline_forms-1.3.7 lib/app/controllers/inline_forms_application_controller.rb