summaryrefslogtreecommitdiffstats
path: root/app/models/document.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-12 08:00:00 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-11-12 08:00:00 +0000
commita8419c1425b55b91edf24db044725d099b6065a8 (patch)
tree722349cd0fbd5907c7380c90f9b46e21c74bd5cc /app/models/document.rb
parent362364fd6f214e135d059f28106ceaa02d9bd7d4 (diff)
downloadredmine-a8419c1425b55b91edf24db044725d099b6065a8.tar.gz
redmine-a8419c1425b55b91edf24db044725d099b6065a8.zip
Fixed: error on activity page when displaying a document (undefined method 'author').
git-svn-id: http://redmine.rubyforge.org/svn/trunk@896 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/document.rb')
-rw-r--r--app/models/document.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/document.rb b/app/models/document.rb
index d95427ee6..7a432b46b 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -22,6 +22,7 @@ class Document < ActiveRecord::Base
acts_as_searchable :columns => ['title', 'description']
acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
+ :author => Proc.new {|o| (a = o.attachments.find(:first, :order => "#{Attachment.table_name}.created_on ASC")) ? a.author : nil },
:url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}}
validates_presence_of :project, :title, :category