]> source.dussan.org Git - redmine.git/commitdiff
shorten long line of app/models/document.rb
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Oct 2020 14:18:06 +0000 (14:18 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 22 Oct 2020 14:18:06 +0000 (14:18 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@20162 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/document.rb

index 19f09efd80d197b93a2d4bcd19ff882b76e5451d..7798e937e6be7e8002cd86f33cd0f27af8750b8c 100644 (file)
@@ -26,10 +26,19 @@ class Document < ActiveRecord::Base
 
   acts_as_searchable :columns => ['title', "#{table_name}.description"],
                      :preload => :project
-  acts_as_event :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
-                :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 :scope => proc { preload(:project) }
+  acts_as_event(
+    :title => Proc.new {|o| "#{l(:label_document)}: #{o.title}"},
+    :author =>
+      Proc.new do |o|
+        o.attachments.reorder("#{Attachment.table_name}.created_on ASC").
+          first.try(:author)
+      end,
+    :url =>
+      Proc.new do |o|
+        {:controller => 'documents', :action => 'show', :id => o.id}
+      end
+  )
+  acts_as_activity_provider :scope => proc {preload(:project)}
 
   validates_presence_of :project, :title, :category
   validates_length_of :title, :maximum => 255