From 0dd10a2297cc9b3d2a0fe991c1d597b8a1d5fcc2 Mon Sep 17 00:00:00 2001 From: David Gay Date: Tue, 25 May 2021 20:30:23 -0400 Subject: Assign instance var in #current_char to avoid multiple DB calls --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controllers/application_controller.rb') diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f3de3a8..94859d1 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base helper_method :current_char def current_char - current_user&.active_character + @_current_char ||= current_user&.active_character end def redirect_if_no_active_character -- cgit v1.2.3