From: Toshi MARUYAMA Date: Thu, 22 Oct 2020 14:18:06 +0000 (+0000) Subject: shorten long line of app/models/document.rb X-Git-Tag: 4.2.0~655 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bb449e202eb7b5c67f9d5f240997637d407c034b;p=redmine.git shorten long line of app/models/document.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20162 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/models/document.rb b/app/models/document.rb index 19f09efd8..7798e937e 100644 --- a/app/models/document.rb +++ b/app/models/document.rb @@ -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