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

Fix N+1 issues in form_controller#show #5945

Merged
merged 11 commits into from
Jul 26, 2024
Merged

Conversation

guswhitten
Copy link
Contributor

What github issue is this PR for, if any?

Resolves #5893

What changed, and why?

Fixes the N+1 issues for the FormController#show that "bullet" complained about. Does this by preloading any record associations that are used later on.

How is this tested? (please write tests!) 💖💪

Screenshots please :)

Before:
casa-5893-before

After:
casa-5893-after

Feelings gif (optional)

@github-actions github-actions bot added dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code labels Jul 26, 2024
@@ -49,18 +49,21 @@ def update
private

def set_case_contact
@case_contact = CaseContact.find(params[:case_contact_id])
Copy link
Collaborator

Choose a reason for hiding this comment

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

(not this PR) someday we should add some palicy_scope to this 😓

Copy link
Collaborator

@compwron compwron left a comment

Choose a reason for hiding this comment

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

nice!

@compwron
Copy link
Collaborator

We could add more tests for number of db queries using a library someday, but we don't have it yet

@compwron compwron merged commit 8b8d8e7 into rubyforgood:main Jul 26, 2024
17 checks passed
@guswhitten guswhitten deleted the issue-5893 branch July 27, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file ruby Pull requests that update Ruby code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix CaseContacts::FormController#show N+1 issues
2 participants