Class: Admin::LocaleController

Inherits:
ApplicationController
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/controllers/admin/locale_controller.rb

Instance Method Summary collapse

Instance Method Details

#updateObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/generators/ruby_cms/templates/controllers/admin/locale_controller.rb', line 8

def update
  locale = params[:locale].to_s.presence&.to_sym
  if I18n.available_locales.include?(locale)
    session[:ruby_cms_locale] = locale
    session[:admin_locale] = locale
    I18n.locale = locale
  end

  redirect_back_or_to(admin_root_path)
end