diff options
Diffstat (limited to 'app/controllers/application_controller.rb')
| -rw-r--r-- | app/controllers/application_controller.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32c7373..75f92c3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb | |||
| @@ -1,10 +1,7 @@ | |||
| 1 | # Filters added to this controller apply to all controllers in the application. | ||
| 2 | # Likewise, all the methods added will be available for all controllers. | ||
| 3 | |||
| 4 | class ApplicationController < ActionController::Base | 1 | class ApplicationController < ActionController::Base |
| 5 | include AuthenticatedSystem | 2 | include AuthenticatedSystem |
| 6 | 3 | ||
| 7 | protect_from_forgery # See ActionController::RequestForgeryProtection for details | 4 | protect_from_forgery |
| 8 | 5 | ||
| 9 | before_action :set_locale | 6 | before_action :set_locale |
| 10 | 7 | ||
| @@ -14,7 +11,11 @@ class ApplicationController < ActionController::Base | |||
| 14 | if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) | 11 | if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) |
| 15 | I18n.locale = params[:locale].to_sym | 12 | I18n.locale = params[:locale].to_sym |
| 16 | else | 13 | else |
| 17 | params.delete(:locale) | 14 | I18n.locale = I18n.default_locale |
| 18 | end | 15 | end |
| 19 | end | 16 | end |
| 17 | |||
| 18 | def default_url_options | ||
| 19 | { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale } | ||
| 20 | end | ||
| 20 | end | 21 | end |
