Class: Lesli::ApplicationController
- Inherits:
-
ActionController::Base
- Object
- ActionController::Base
- Lesli::ApplicationController
- Defined in:
- app/controllers/lesli/application_controller.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#engine_path ⇒ Object
readonly
Returns the value of attribute engine_path.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
-
#initialize ⇒ ApplicationController
constructor
A new instance of ApplicationController.
- #language ⇒ Object
Constructor Details
#initialize ⇒ ApplicationController
Returns a new instance of ApplicationController.
42 43 44 45 46 47 |
# File 'app/controllers/lesli/application_controller.rb', line 42 def initialize super @lesli = { engine_name: self.class.module_parent.name } end |
Instance Attribute Details
#engine_path ⇒ Object (readonly)
Returns the value of attribute engine_path.
40 41 42 |
# File 'app/controllers/lesli/application_controller.rb', line 40 def engine_path @engine_path end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
39 40 41 |
# File 'app/controllers/lesli/application_controller.rb', line 39 def query @query end |
Instance Method Details
#language ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'app/controllers/lesli/application_controller.rb', line 60 def language # check if param locale was sent by the user unless params[:locale].blank? locale = params[:locale].to_sym # check if locale requested is valid if I18n.available_locales.include?(locale) # save requested locale in session # this will be used in application_controller#switch_locale session[:locale] = locale end end I18n.locale = locale redirect_back(fallback_location: request.referer) # This code is not really executed # respond_with_successful({ # locale: I18n.locale, # default_locale: I18n.default_locale, # available_locales: I18n.available_locales # }) end |