finishes i18n set_locale with user settings
This commit is contained in:
parent
5b7ec86ed6
commit
2c1d9aeb9c
4 changed files with 7 additions and 1 deletions
|
@ -16,6 +16,7 @@ class HomeController < ApplicationController
|
|||
|
||||
def update_profile
|
||||
if @current_user.update_attributes(params[:user])
|
||||
session[:locale] = @current_user.locale
|
||||
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
||||
else
|
||||
render :profile
|
||||
|
|
|
@ -58,6 +58,7 @@ class LoginController < ApplicationController
|
|||
if @user.save
|
||||
Membership.new(:user => @user, :group => @invite.group).save!
|
||||
@invite.destroy
|
||||
session[:locale] = @user.locale
|
||||
redirect_to login_url, notice: I18n.t('login.controller.accept_invitation.notice')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -57,6 +57,10 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def locale
|
||||
settings.profile['language']
|
||||
end
|
||||
|
||||
def name
|
||||
[first_name, last_name].join(" ")
|
||||
end
|
||||
|
|
|
@ -13,7 +13,7 @@ module Foodsoft
|
|||
end
|
||||
|
||||
def user_settings_language
|
||||
current_user.settings.profile['language'] if current_user
|
||||
current_user.locale if current_user
|
||||
end
|
||||
|
||||
def session_language
|
||||
|
|
Loading…
Reference in a new issue