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.
GlobalId::Locator.locate
callsprimary_key
on the model class.https://github.com/rails/globalid/blob/488ab6c67d17219ba3b23fc5ade434a1faaa915f/lib/global_id/locator.rb#L204
In this case, the model_class is an ActiveRecord::AssociatedObject. ActiveRecord::AssociatedObject does not delegate
primary_key
to record_class, and therefore the method_missing gets called.active_record-associated_object/lib/active_record/associated_object.rb
Lines 22 to 26 in 67f509d
This method_missing code is then essentially doing:
Post.primary_key.publisher
, which is"id".publisher
This, of course, errors. By delegating the
primary_key
method, this is now defined, returns "id", and deserializes just fine.Note: I had to
bundle update nokogiri
, because I kept getting: