This repository was archived by the owner on Oct 16, 2019. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The membership cache was being serialized into the user object. It was assumed that the user object was serialized at the end of each request. It turns out that this is not the case. Instead, the user object only gets serialized once, namely after setting the user. This means that the membership cache wasn't working at all between requests.
This commit fixes it by not including the memberships in the serialized user as there's no point in doing so. Instead, after the user object is set up, the memberships hash get retrieved from the user session (warden provides a session object for each scope; if there is none, a new hash is stored in the session) and assigned to the user object. The hash is
then used as before and we get the session serialization from rack for free.
Fixes #52.