Adds a rake test that removes old unattached uploads (#10253).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8893 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-02-16 21:18:01 +00:00
parent 4c090e869e
commit b455ac2a27
3 changed files with 37 additions and 1 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ class Attachment < ActiveRecord::Base
end
def self.prune(age=1.day)
attachments = Attachment.all(:conditions => ["created_on < ? AND (container_type IS NULL OR container_type = ''", Time.now - age])
attachments = Attachment.all(:conditions => ["created_on < ? AND (container_type IS NULL OR container_type = '')", Time.now - age])
attachments.each(&:destroy)
end