summaryrefslogtreecommitdiff
path: root/app/controllers/application_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r--app/controllers/application_controller.rb35
1 files changed, 15 insertions, 20 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index bce0c71..75f92c3 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,26 +1,21 @@
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
4class ApplicationController < ActionController::Base 1class ApplicationController < ActionController::Base
5
6 include ExceptionNotifiable
7 include AuthenticatedSystem 2 include AuthenticatedSystem
8
9 helper :all # include all helpers, all the time
10 protect_from_forgery # See ActionController::RequestForgeryProtection for details
11 3
12 # Scrub sensitive parameters from your log 4 protect_from_forgery
13 filter_parameter_logging :password, :password_confirmation 5
14 6 before_action :set_locale
15 before_filter :set_locale 7
16
17 protected 8 protected
18 9
19 def set_locale 10 def set_locale
20 if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym) 11 if params[:locale] && I18n.available_locales.include?(params[:locale].to_sym)
21 I18n.locale = params[:locale].to_sym 12 I18n.locale = params[:locale].to_sym
22 else 13 else
23 params.delete(:locale) 14 I18n.locale = I18n.default_locale
24 end
25 end 15 end
16 end
17
18 def default_url_options
19 { locale: I18n.locale == I18n.default_locale ? nil : I18n.locale }
20 end
26end 21end