GlobalID::Identification clears memoized to_global_id on dup#109
GlobalID::Identification clears memoized to_global_id on dup#109rafaelfranca merged 2 commits intorails:masterfrom
Conversation
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.
|
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. |
|
I had completely glossed over the fact that to_global_id accepted arguments. Updating the patch without memoization. |
|
@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 |
|
A release will happen soon ™️. But you can always use the version from git while it is still not released. |
This module is used in ActiveRecord, which resets the model's primary key on
dup. If we don't clear it here, then aduped ActiveRecord instance can havean invalid GlobalID.
See rails/rails#33679