aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Rees <gareth@mysociety.org>2015-04-30 17:44:26 +0100
committerGareth Rees <gareth@mysociety.org>2015-05-07 15:53:14 +0100
commit0503e342f8aa08b70f6b14c75ec5c0bf402aa813 (patch)
treeef2491d3128884ba25ad94e06ecadbbbd212e465
parent67d69ce1f8f81f44c0099e631d0ba95fc02d9763 (diff)
Reduce N+1 queries getting update body requests
Removes the following bullet warnings: N+1 Query detected PublicBodyChangeRequest => [:public_body] Add to your finder: :includes => [:public_body] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:65:in `get_public_body_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:8:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:225:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:224:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call' N+1 Query detected PublicBodyChangeRequest => [:user] Add to your finder: :includes => [:user] N+1 Query method call stack /home/vagrant/alaveteli/app/models/public_body_change_request.rb:57:in `get_user_name' /home/vagrant/alaveteli/app/views/admin_general/_change_request_summary.html .erb:46:in `_app_views_admin_general__change_request_summary_html_erb__490351475_701155 42681500' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:225:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/views/admin_general/index.html.erb:224:in `_app_views_admin_general_index_html_erb___48164640_70115537288900' /home/vagrant/alaveteli/app/controllers/application_controller.rb:111:in `record_memory' /home/vagrant/alaveteli/lib/whatdotheyknow/strip_empty_sessions.rb:14:in `call'
-rw-r--r--app/controllers/admin_general_controller.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb
index 35f872666..d5838f2da 100644
--- a/app/controllers/admin_general_controller.rb
+++ b/app/controllers/admin_general_controller.rb
@@ -35,7 +35,10 @@ class AdminGeneralController < AdminController
includes(:public_body, :user).
new_body_requests.
open
- @body_update_requests = PublicBodyChangeRequest.body_update_requests.open
+ @body_update_requests = PublicBodyChangeRequest.
+ includes(:public_body, :user).
+ body_update_requests.
+ open
end
def timeline