diff options
author | Gareth Rees <gareth@mysociety.org> | 2015-05-06 13:44:21 +0100 |
---|---|---|
committer | Gareth Rees <gareth@mysociety.org> | 2015-05-07 15:53:14 +0100 |
commit | 5280034f83a4e7f000945ee45bc96a659dcd4619 (patch) | |
tree | 144a064fd9d6ee9ef49d941abbc022597ea86ad6 | |
parent | 44be6f9014728c83adbc582baaba29c231365643 (diff) |
Remove N+1 Query
Removes the following bullet warning:
N+1 Query detected
PublicBody => [:translations]
Add to your finder: :includes => [:translations]
N+1 Query method call stack
/home/vagrant/alaveteli/app/helpers/link_to_helper.rb:70:in
`public_body_url'
/home/vagrant/alaveteli/app/helpers/link_to_helper.rb:74:in
`public_body_path'
/home/vagrant/alaveteli/app/helpers/admin_helper.rb:28:in
`public_body_both_links'
/home/vagrant/alaveteli/app/views/admin_general/index.html.erb:148:in
`_app_views_admin_general_index_html_erb__1495531968_70090875267640'
/home/vagrant/alaveteli/app/views/admin_general/index.html.erb:145:in
`each'
/home/vagrant/alaveteli/app/views/admin_general/index.html.erb:145:in
`_app_views_admin_general_index_html_erb__1495531968_70090875267640'
/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.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/admin_general_controller.rb b/app/controllers/admin_general_controller.rb index 7034fa17d..c81b397a3 100644 --- a/app/controllers/admin_general_controller.rb +++ b/app/controllers/admin_general_controller.rb @@ -24,7 +24,7 @@ class AdminGeneralController < AdminController @error_message_requests = InfoRequest.find_in_state('error_message') @attention_requests = InfoRequest.find_in_state('attention_requested') @blank_contacts = PublicBody. - includes(:tags). + includes(:tags, :translations). where(:request_email => ""). order(:updated_at). select { |pb| !pb.defunct? } |