summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-11-08 21:31:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-11-08 21:31:18 +0000
commit328e0767228bbd1200bb33134fee82c97a28255b (patch)
treed4cd16d88355cc412c5216e19953465a17974082
parentdff15dcc9a9a480fd9fddbaee37a706a700ce4d9 (diff)
downloadredmine-328e0767228bbd1200bb33134fee82c97a28255b.tar.gz
redmine-328e0767228bbd1200bb33134fee82c97a28255b.zip
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
-rw-r--r--app/models/project.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 323a70632..9868e0444 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.