From bb449e202eb7b5c67f9d5f240997637d407c034b Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Thu, 22 Oct 2020 14:18:06 +0000 Subject: [PATCH] shorten long line of app/models/document.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20162 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/document.rb | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 -- 2.39.5