From 2c6eb234079ff1175574257f7131d9986317e9f1 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Wed, 9 Jul 2014 19:21:44 -0300 Subject: [PATCH] content-viewer-controller: include relations on posts to avoid database multiple repetitive queries --- app/controllers/public/content_viewer_controller.rb | 2 ++ 1 file changed, 2 insertions(+), 0 deletions(-) diff --git a/app/controllers/public/content_viewer_controller.rb b/app/controllers/public/content_viewer_controller.rb index fdc03dd..8f62722 100644 --- a/app/controllers/public/content_viewer_controller.rb +++ b/app/controllers/public/content_viewer_controller.rb @@ -83,6 +83,8 @@ class ContentViewerController < ApplicationController @page.posts end + posts = posts.includes(:parent, {:profile => [:domains, :environment]}) + #FIXME Need to run this before the pagination because this version of # will_paginate returns a will_paginate collection instead of a # relation. -- libgit2 0.21.2