Class: Pgbus::LocaleController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pgbus/locale_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#pgbus

Instance Method Details

#updateObject



5
6
7
8
9
10
11
12
13
# File 'app/controllers/pgbus/locale_controller.rb', line 5

def update
  locale = params[:locale].to_s
  if available_locales.include?(locale.to_sym)
    cookies[:pgbus_locale] = { value: locale, expires: 1.year.from_now, path: "/" }
    I18n.locale = locale
  end

  redirect_back fallback_location: pgbus.root_path
end