Commit 2c6eb234079ff1175574257f7131d9986317e9f1
1 parent
0fb6c374
Exists in
master
and in
29 other branches
content-viewer-controller: include relations on posts to avoid database multiple repetitive queries
ActionItem3201
Showing
1 changed file
with
2 additions
and
0 deletions
Show diff stats
app/controllers/public/content_viewer_controller.rb
| ... | ... | @@ -83,6 +83,8 @@ class ContentViewerController < ApplicationController |
| 83 | 83 | @page.posts |
| 84 | 84 | end |
| 85 | 85 | |
| 86 | + posts = posts.includes(:parent, {:profile => [:domains, :environment]}) | |
| 87 | + | |
| 86 | 88 | #FIXME Need to run this before the pagination because this version of |
| 87 | 89 | # will_paginate returns a will_paginate collection instead of a |
| 88 | 90 | # relation. | ... | ... |