Title: Fields filtering with include · Issue #1475 · JSONAPI-Resources/jsonapi-resources · GitHub
Open Graph Title: Fields filtering with include · Issue #1475 · JSONAPI-Resources/jsonapi-resources
X Title: Fields filtering with include · Issue #1475 · JSONAPI-Resources/jsonapi-resources
Description: Version 0.9.12 When using fields[events]=name + include=establishment the key relationships disappear from the response hash. Basic association is events belongs_to establishment Issue is coming from here: # JSONAPI::ResourceSerializer#s...
Open Graph Description: Version 0.9.12 When using fields[events]=name + include=establishment the key relationships disappear from the response hash. Basic association is events belongs_to establishment Issue is coming fr...
X Description: Version 0.9.12 When using fields[events]=name + include=establishment the key relationships disappear from the response hash. Basic association is events belongs_to establishment Issue is coming fr...
Opengraph URL: https://github.com/JSONAPI-Resources/jsonapi-resources/issues/1475
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fields filtering with include","articleBody":"Version `0.9.12`\n\nWhen using `fields[events]=name` + `include=establishment` the key `relationships` disappear from the response hash. \n\nBasic association is `events belongs_to establishment`\n\nIssue is coming from here:\n\n```ruby\n\n# JSONAPI::ResourceSerializer#supplying_relationship_fields\n\ndef supplying_relationship_fields(resource_klass)\n @_supplying_relationship_fields.fetch resource_klass do\n relationships = Set.new(resource_klass._relationships.keys.map(\u0026:to_sym))\n cur = resource_klass\n while cur != JSONAPI::Resource\n if @fields.has_key?(cur._type)\n # here... \n # It always empty the Set\n #relationships \u0026= @fields[cur._type]\n break\n end\n cur = cur.superclass\n end\n @_supplying_relationship_fields[resource_klass] = relationships\n end\n end\n```\n\nCommenting `relationships \u0026= @fields[cur._type]` solves this issue. @DavidMikeSimon could you describe your mind here? I know it was a [loooong time ago](https://github.com/cerebris/jsonapi-resources/blame/6a10162ada6f2b020db418520b674c2c3af948f6/lib/jsonapi/resource_serializer.rb) but your help might help to correctly fix this issue. ","author":{"url":"https://github.com/brcebn","@type":"Person","name":"brcebn"},"datePublished":"2025-09-22T13:57:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/1475/jsonapi-resources/issues/1475"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ce749af3-005f-d92c-e912-4b54cadf4a84 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 98B4:18BA88:3E701CB:567DE19:6A4F586A |
| html-safe-nonce | f85e52683567edef97f75a1f94d2f2d24a5066dfe5cdf3c1f97510dec6f8e040 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OEI0OjE4QkE4ODozRTcwMUNCOjU2N0RFMTk6NkE0RjU4NkEiLCJ2aXNpdG9yX2lkIjoiMTU0MzAxNjA5NDM0Nzc3ODE1NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4311e61be331a0418594f2a01c6d2b62cf5382a0e2fa467ea8e9c7c042014fff |
| hovercard-subject-tag | issue:3441141074 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSONAPI-Resources/jsonapi-resources/1475/issue_layout |
| twitter:image | https://opengraph.githubassets.com/391c2e16b07ee17748a1e0d8ab2c79cfacc14c3b221bc52f81b40efde146bc23/JSONAPI-Resources/jsonapi-resources/issues/1475 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/391c2e16b07ee17748a1e0d8ab2c79cfacc14c3b221bc52f81b40efde146bc23/JSONAPI-Resources/jsonapi-resources/issues/1475 |
| og:image:alt | Version 0.9.12 When using fields[events]=name + include=establishment the key relationships disappear from the response hash. Basic association is events belongs_to establishment Issue is coming fr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | brcebn |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/JSONAPI-Resources/jsonapi-resources git https://github.com/JSONAPI-Resources/jsonapi-resources.git |
| octolytics-dimension-user_id | 262422067 |
| octolytics-dimension-user_login | JSONAPI-Resources |
| octolytics-dimension-repository_id | 18248068 |
| octolytics-dimension-repository_nwo | JSONAPI-Resources/jsonapi-resources |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 18248068 |
| octolytics-dimension-repository_network_root_nwo | JSONAPI-Resources/jsonapi-resources |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b14b8c6d72fdb96ca48aba85dec94fe96ce5adbe |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width