Skip to content

Commit f687330

Browse files
committed
trying to fix n+1 in CaseContactsController
1 parent 64f33ed commit f687330

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ npm-debug.log
6161

6262
# In case we want to keep something in the compiled assets directory
6363
!/app/assets/builds/.keep
64+
.aider*

app/controllers/case_contacts_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def all_case_contacts
107107
:creator,
108108
:followups,
109109
:contact_types,
110-
contact_topic_answers: [:contact_topic]
110+
contact_topic_answers: [:contact_topic],
111+
casa_case: [:volunteers]
111112
)
112113
end
113114

app/presenters/case_contact_presenter.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ def boolean_select_options
2525
private
2626

2727
def org_cases
28-
CasaOrg.includes(:casa_cases)
29-
.references(:casa_cases)
30-
.find_by(id: current_user.casa_org_id)
31-
.casa_cases
28+
CasaOrg.find(current_user.casa_org_id).casa_cases.active
3229
end
3330
end

0 commit comments

Comments
 (0)