From 328e0767228bbd1200bb33134fee82c97a28255b 2015-11-08 21:31:18 From: Jean-Philippe Lang Date: 2015-11-08 21:31:18 Subject: [PATCH] Don't show projects created more than 30 days ago in "Latest projects" (#21148). git-svn-id: http://svn.redmine.org/redmine/trunk@14854 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/project.rb b/app/models/project.rb index 323a706..9868e04 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -149,7 +149,10 @@ class Project < ActiveRecord::Base # returns latest created projects # non public projects will be returned only if user is a member of those def self.latest(user=nil, count=5) - visible(user).limit(count).order("created_on DESC").to_a + visible(user).limit(count). + order(:created_on => :desc). + where("#{table_name}.created_on >= ?", 30.days.ago). + to_a end # Returns true if the project is visible to +user+ or to the current user.