|
|
|
@ -14,15 +14,14 @@ class CostObject < ActiveRecord::Base |
|
|
|
|
|
|
|
|
|
acts_as_attachable :after_remove => :attachment_removed |
|
|
|
|
|
|
|
|
|
unless respond_to? :acts_as_journalized |
|
|
|
|
acts_as_event :title => Proc.new {|o| "#{l(:label_cost_object)} ##{o.id}: #{o.subject}"}, |
|
|
|
|
:url => Proc.new {|o| {:controller => '/cost_objects', :action => 'show', :id => o.id}} |
|
|
|
|
acts_as_journalized |
|
|
|
|
|
|
|
|
|
acts_as_activity_provider :find_options => {:include => [:project, :author]}, |
|
|
|
|
:timestamp => "#{table_name}.updated_on", |
|
|
|
|
:author_key => :author_id |
|
|
|
|
end |
|
|
|
|
acts_as_journalized :event_type => 'cost-object', |
|
|
|
|
:event_title => Proc.new {|o| "#{l(:label_cost_object)} ##{o.journaled.id}: #{o.subject}"}, |
|
|
|
|
:event_url => Proc.new {|o| {:controller => 'cost_objects', :action => 'show', :id => o.journaled.id}}, |
|
|
|
|
:activity_type => superclass.plural_name, |
|
|
|
|
:activity_find_options => {:include => [:project, :author]}, |
|
|
|
|
:activity_timestamp => "#{table_name}.updated_on", |
|
|
|
|
:activity_author_key => :author_id, |
|
|
|
|
:activity_permission => :view_cost_objects |
|
|
|
|
|
|
|
|
|
validates_presence_of :subject, :project, :author, :kind |
|
|
|
|
validates_length_of :subject, :maximum => 255 |
|
|
|
|