class SettingsController < ApplicationController
def change_locale
l = params[:locale].to_s.strip.to_sym
l = I18n.default_locale unless I18n.available_locales.include?(l)
cookies.permanent[:avalanche_locale] = l
if user_signed_in?
current_user.update(language: l)
end
redirect_to :back || root_url
end
end
|