diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 18:21:32 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-12-03 18:21:32 +0000 |
commit | 31c33f462d92aead29b8feb6445d8fe5626c4963 (patch) | |
tree | 0818c626e553e1cbb606e9c23a7342583288d448 /app/models/document.rb | |
parent | 013c6fe009e74892659c64c2936a2668a9663985 (diff) | |
download | redmine-31c33f462d92aead29b8feb6445d8fe5626c4963.tar.gz redmine-31c33f462d92aead29b8feb6445d8fe5626c4963.zip |
Replaces find(:first) calls.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10928 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/document.rb')
-rw-r--r-- | app/models/document.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/document.rb b/app/models/document.rb index 0eaf171ed..3fd43e1c0 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -23,7 +23,7 @@ class Document < ActiveRecord::Base acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project 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 }, + :author => Proc.new {|o| o.attachments.reorder("#{Attachment.table_name}.created_on ASC").first.try(:author) }, :url => Proc.new {|o| {:controller => 'documents', :action => 'show', :id => o.id}} acts_as_activity_provider :find_options => {:include => :project} |