rails-authentication-from-scratch icon indicating copy to clipboard operation
rails-authentication-from-scratch copied to clipboard

Adds current_active_session helper, memoization for current_user

Open mdchaney opened this issue 8 months ago • 0 comments

Closes #93, "Why is the ||= removed? current_user method". This adds memoization back to current_user / Current.user, plus causes log out when the current session is destroyed.

With this change, it's easy to find the current session and check its id against the param. The user is logged out if the current session is destroyed, allowing the tests to pass with memoization in place.

mdchaney avatar Jun 12 '24 02:06 mdchaney