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

Clear the model's association cache before resolving its association #435

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Aug 16, 2024

Fixes #420

This PR also fixes the CI failure with Rails main Gemfile.

@st0012 st0012 added the bugfix This PR fixes an existing bug label Aug 16, 2024
@st0012 st0012 self-assigned this Aug 16, 2024
@st0012 st0012 requested a review from a team as a code owner August 16, 2024 19:35
@@ -152,6 +152,8 @@ def resolve_association_target(params)
}
end

# Clear the cache so that we get the latest associations.
const.clear_reflections_cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach would mean that we essentially never have reflections cached. Do we know how expensive that could be?

Would it be worth trying to only clear the cache based on file modifications, similar to how we handle reloading on schema changes?

@@ -7,7 +7,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gemspec path: ".."

gem "puma"
gem "sqlite3", "< 2"
gem "sqlite3"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need the constraint in the main Gemfile?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This PR fixes an existing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

go-to-definition for new associations doesn't work until Ruby LSP is restarted
3 participants