Class: Hello::Internationalization::LocaleController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Hello::Internationalization::LocaleController
- Defined in:
- app/controllers/hello/internationalization/locale_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /hello/locale.
-
#update ⇒ Object
POST /hello/locale.
Instance Method Details
#index ⇒ Object
GET /hello/locale
7 8 9 10 11 12 |
# File 'app/controllers/hello/internationalization/locale_controller.rb', line 7 def index respond_to do |format| format.html { render 'hello/internationalization/locales' } format.json { render json: { locales: view_context.available_locales_with_names } } end end |
#update ⇒ Object
POST /hello/locale
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/hello/internationalization/locale_controller.rb', line 15 def update business = Business::Internationalization::UpdateLocale.new(params['locale']) current_user && current_user.update!(locale: business.locale) use_locale(business.locale) respond_to do |format| format.html { redirect_to :back, notice: business. } format.json { fail Hello::Errors::JsonNotSupported } end end |