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 UserBlockedChecker

#check_user_block_status, #check_user_not_blocked

Methods included from NeedsSnippets

#snippets

Methods included from HttpCachingDisabler

#disable_http_caching

Methods included from HasStoredPath

#skip_store_location?, #store_current_location

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#createObject



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

def create
  enforce_permission_to :create, :locales
  current_user.update!(locale: params["locale"]) if current_user && params["locale"] && available_locales.include?(params["locale"])

  redirect_to referer_with_new_locale
end