summaryrefslogtreecommitdiffstats
path: root/app/models/document.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-26 20:12:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-11-26 20:12:20 +0000
commit43fd27fd0ce4111501c36a6ef162aed61bf3318c (patch)
tree6a805a37c06baaba9a1c2935f32b22e6bca2cafb /app/models/document.rb
parentf3bcb705f74622afae785d9df793a0bbed3a11d3 (diff)
downloadredmine-43fd27fd0ce4111501c36a6ef162aed61bf3318c.tar.gz
redmine-43fd27fd0ce4111501c36a6ef162aed61bf3318c.zip
Show last update datetime (last attachment added) on document list (#4232).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3095 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/document.rb')
-rw-r--r--app/models/document.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/document.rb b/app/models/document.rb
index a96c278d0..1318e823d 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -34,4 +34,12 @@ class Document < ActiveRecord::Base
self.category ||= DocumentCategory.default
end
end
+
+ def updated_on
+ unless @updated_on
+ a = attachments.find(:first, :order => 'created_on DESC')
+ @updated_on = (a && a.created_on) || created_on
+ end
+ @updated_on
+ end
end