From 75f3fbe9f87422099aa1c6ec50c115bde32275ba Mon Sep 17 00:00:00 2001 From: Daniel Miranda Date: Fri, 15 Apr 2016 17:03:28 -0300 Subject: [PATCH] Fix home page latest content cache efectiveness --- app/controllers/home_controller.rb | 16 ++++++++++++---- app/views/home/index.html.erb | 6 +++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 3b0950c..aa5d5ee 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,7 +1,15 @@ class HomeController < ApplicationController - def index - @latest_projects = Project.latest(5) - @latest_repositories = Repository.latest(5) - @latest_configurations = KalibroConfiguration.latest(5) + helper_method :latest_projects, :latest_repositories, :latest_configurations + + def latest_projects(count) + Project.latest(count) + end + + def latest_repositories(count) + Repository.latest(count) + end + + def latest_configurations(count) + KalibroConfiguration.latest(count) end end diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index c08047f..2cd4124 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -13,7 +13,7 @@