Skip to content
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

GlobalID::Identification clears memoized to_global_id on dup #109

Merged
merged 2 commits into from
Aug 24, 2018

Conversation

bradleybuda
Copy link
Contributor

This module is used in ActiveRecord, which resets the model's primary key on
dup. If we don't clear it here, then a duped ActiveRecord instance can have
an invalid GlobalID.

See rails/rails#33679

This module is used in ActiveRecord, which resets the model's primary key on
`dup`. If we don't clear it here, then a `dup`ed ActiveRecord instance can have
an invalid GlobalID.
@rails-bot
Copy link

Thanks for the pull request, and welcome! The Rails team is excited to review your changes, and you should hear from @kaspth (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@kamipo
Copy link
Member

kamipo commented Aug 23, 2018

I think we should get rid of the memoization since to_gid allows params since #75.

See also #60, #58.

@bradleybuda
Copy link
Contributor Author

I had completely glossed over the fact that to_global_id accepted arguments. Updating the patch without memoization.

@rafaelfranca rafaelfranca merged commit a9c4e1e into rails:master Aug 24, 2018
@kevinmsun
Copy link

@kaspth @rafaelfranca is there a way we could cut a new release that includes this change? I would consider this memoization (that ignores the arguments) a bug

@rafaelfranca
Copy link
Member

A release will happen soon ™️. But you can always use the version from git while it is still not released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants