Fix scope class name when setting resource by token #1482
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.
Hi! I'm pushing this change without tests just to make sure the change makes sense before actually writing the specs.
I noticed the scope name is no properly set for models that exist within another model like
Users::Customer
. I see in places like this that you actually handle that so not doing the same in the concern was probably just overlooked.The current
scope = rc.to_s.underscore.to_sym
will generateusers/customer
as the scope name and this is a problem as the devise mapping name will beusers_customer
. The problem with this and the reason I saw this is that when using thesign_in
method, warden will try to serialize the resource and when trying to do so here and here it will fail to find the custom devise serializer for the model and will simply useserialize
. This can (and has happened to me) lead to cookie overflows as the model can be potentially big default serialization will include all columns in the serialized string.Let me know what you think, happy to add specs if you think this is fine, but I guess I would have to add another model scoped to a module in order to do so.