From bb5500b88c28ca2cae0e4ad03835658e98123b9d Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 20 Jun 2022 13:57:26 +0100 Subject: [PATCH] Only select the fields we actually need --- app/models/form/setup/questions/created_by_id.rb | 2 +- app/models/form/setup/questions/owning_organisation_id.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/form/setup/questions/created_by_id.rb b/app/models/form/setup/questions/created_by_id.rb index 1342ef34f..a6e12f666 100644 --- a/app/models/form/setup/questions/created_by_id.rb +++ b/app/models/form/setup/questions/created_by_id.rb @@ -14,7 +14,7 @@ class Form::Setup::Questions::CreatedById < ::Form::Question answer_opts = { "" => "Select an option" } return answer_opts unless ActiveRecord::Base.connected? - User.all.each_with_object(answer_opts) do |user, hsh| + User.select(:id, :name).all.each_with_object(answer_opts) do |user, hsh| hsh[user.id] = user.name hsh end diff --git a/app/models/form/setup/questions/owning_organisation_id.rb b/app/models/form/setup/questions/owning_organisation_id.rb index c26aa6d16..8ddebc0da 100644 --- a/app/models/form/setup/questions/owning_organisation_id.rb +++ b/app/models/form/setup/questions/owning_organisation_id.rb @@ -14,7 +14,7 @@ class Form::Setup::Questions::OwningOrganisationId < ::Form::Question answer_opts = { "" => "Select an option" } return answer_opts unless ActiveRecord::Base.connected? - Organisation.all.each_with_object(answer_opts) do |organisation, hsh| + Organisation.select(:id, :name).all.each_with_object(answer_opts) do |organisation, hsh| hsh[organisation.id] = organisation.name hsh end