configure i18n

This commit is contained in:
Zachary Chai
2016-11-03 17:22:33 -04:00
parent 9a6b75d15b
commit 84fb5c617f
4 changed files with 16 additions and 0 deletions

View File

@ -3,6 +3,11 @@ require 'digest/sha1'
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :set_locale
def set_locale
I18n.locale = http_accept_language.language_region_compatible_from(I18n.available_locales)
end
def current_user
@current_user ||= User.find_by(id: session[:user_id])