Fix unnecessary SQL query performed on unauthenticated requests (#11179)

remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
Eugen Rochko 2019-06-25 20:18:15 +02:00 committed by GitHub
parent 8d57795608
commit 6836587117
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -91,11 +91,15 @@ class ApplicationController < ActionController::Base
end
def current_account
@current_account ||= current_user.try(:account)
return @current_account if defined?(@current_account)
@current_account = current_user&.account
end
def current_session
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
return @current_session if defined?(@current_session)
@current_session = SessionActivation.find_by(session_id: cookies.signed['_session_id']) if cookies.signed['_session_id'].present?
end
def current_theme