-
Notifications
You must be signed in to change notification settings - Fork 530
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
UUIDResource has_many IdResource causes undefined method []
when doing GET [...]?includes=
#1156
Comments
And when I build a unit test for this it works fine... I'll re-check whats going on. |
Still not sure how to reproduce in unit tests. This branch fixes my production code issue_1156 |
Yep this is definitely an issue - I have pushed a unit test that fails. If the top-level controller resource is a UUID then it will cast all the included resources primary keys as strings instead of integers. Change that top level resource from UUID -> integer and the unit test will then pass. The If I force the It looks like This is probably related to a Rails bug i found Unexpected Type Casting in ActiveRecord::Calculations#pluck #28044 |
This issue is a (choose one):
Description
I've tracked the issue to
lib/jsonapi/processor.rb:587
.resource_set[resource_klass]
is holding the associated resources in an array key'd by a string{"1" => [...]}
and attempting to access it via an intresource.id
.With the following resources just issue this get request (make sure to have include=).
GET /uuids/3bbaf722-4583-4fa6-ac36-9190d4b93f80?include=ids
Throws error:
The text was updated successfully, but these errors were encountered: