mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
shorten long line of app/models/document.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20162 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user