Skip to content
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

Make sure we correctly find the association within preload_scoped_relation method #75

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

wendy-clio
Copy link
Contributor

@wendy-clio wendy-clio commented Oct 30, 2024

During testing to upgrade Manage to latest jit_preloader(3.0.0, build) I found that there's some places we use string as base_association name when calling preload_scoped_relation method(example).

With the latest version, this is causing the error of not able to find the association and properly(ActiveRecord native method of finding association is only allow passing a symbol of association name reference) and therefore not caching the preload successfully.

The previous version that Manage currently use(1.0.4) also has the same bug but due to the difference ways of assigning preload values to the cache(Unfortunately, ActiveRecord has different behaviour between fetching an association and preload one), the problem is minor and not obvious.

This PR is doing a simple fix of ensuring the base_association is a symbol before fetching the owner object association.

Take a look at this build which all tests are passing when using this PR branch jit_preloader version.

@wendy-clio wendy-clio merged commit c21a6d3 into master Nov 4, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants