Class: Decidim::LocalesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/decidim/locales_controller.rb

Overview

A controller to allow users switching their locale.

Instance Method Summary collapse

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#createObject



8
9
10
11
12
13
14
# File 'app/controllers/decidim/locales_controller.rb', line 8

def create
  if current_user && params["locale"] && available_locales.include?(params["locale"])
    current_user.update_attributes!(locale: params["locale"])
  end

  redirect_to referer_with_new_locale
end