rails-authentication-from-scratch
rails-authentication-from-scratch copied to clipboard
Adds current_active_session helper, memoization for current_user
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.