Class: InlineFormsApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- InlineFormsApplicationController
- Defined in:
- lib/app/controllers/inline_forms_application_controller.rb
Instance Method Summary collapse
-
#extract_locale_from_subdomain ⇒ Object
Get locale code from request subdomain (like it.application.local:3000).
-
#set_locale ⇒ Object
set the locale based on the subdomain.
Instance Method Details
#extract_locale_from_subdomain ⇒ Object
Get locale code from request subdomain (like it.application.local:3000)
15 16 17 18 19 |
# File 'lib/app/controllers/inline_forms_application_controller.rb', line 15 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 |
#set_locale ⇒ Object
set the locale based on the subdomain
10 11 12 |
# File 'lib/app/controllers/inline_forms_application_controller.rb', line 10 def set_locale I18n.locale = extract_locale_from_subdomain || I18n.default_locale end |