diff options
author | David Gay <david@davidgay.org> | 2021-05-25 20:30:23 -0400 |
---|---|---|
committer | David Gay <david@davidgay.org> | 2021-05-25 20:30:23 -0400 |
commit | 0dd10a2297cc9b3d2a0fe991c1d597b8a1d5fcc2 (patch) | |
tree | c777e16467bf813cd4f02d3e69a28afec25519d3 /app/controllers | |
parent | 5041f03e272e9e1f3726b5f6b21b3d45cd78dd22 (diff) |
Assign instance var in #current_char to avoid multiple DB calls
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/application_controller.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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 |