-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why is the ||= removed? current_user method #93
Comments
Excellent question! I think the issue was that I was getting failing tests when I introduced af768c2, and just assumed memoization was the culprit. However, that assumption might be incorrect. I think I'll need to investigate if the rails-authentication-from-scratch/test/test_helper.rb Lines 13 to 19 in 0416b6f
|
I believe the tests are failing because using rails-authentication-from-scratch/app/controllers/active_sessions_controller.rb Lines 4 to 16 in 0e9d1de
|
Closes stevepolitodesign#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.
I thought the whole point of having this operator was to have the user memoized? With it removed yes the current user is cached into the db, but does that not add to response time? Are there pitfalls in keeping the
Current.user ||=
instead of the updated:Current.user =
.Looking for clarification, more detail on this. Thanks.
The text was updated successfully, but these errors were encountered: