fix: include has_one through associations in compute_select_fields in ResourcesGetter #732
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.
Hi 👋
Background
forest_liana 9.12.0 introduced a db query optimisation which includes specifying fields which are to be fetched from the database.
This seems to cause an error when requesting an
has_one through
association as one of the fields for the requested resource.E.g.
Request params:
Results in an error:
Possibly unrelated to this, we also see errors related to fetching a
belongs_to
polymorphic association on a record. I am having a hard time replicating this issue using tests within the gem test suite. It's possible this is because the gem uses Rails 6.1.7.9 while we use Rails 8.0.2 in our app.Request params:
Error:
This PR fixes both issues.
I'd appreciate your opinions on this approach and would be happy to help validate any alternative ones.
Affected Versions
Forest agent (forest_liana) >= 9.12.0
Definition of Done
General
Security