Using acts_as_journalized if available

This is not tested - it was just introduced to reduce the degree of being broken
pull/6827/head
Gregor Schmidt 13 years ago
parent 8c663a30d8
commit b50ff2f3b9
  1. 14
      app/models/cost_object.rb

@ -17,9 +17,15 @@ class CostObject < ActiveRecord::Base
acts_as_event :title => Proc.new {|o| "#{l(:label_cost_object)} ##{o.id}: #{o.subject}"}, 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}} :url => Proc.new {|o| {:controller => 'cost_objects', :action => 'show', :id => o.id}}
acts_as_activity_provider :find_options => {:include => [:project, :author]}, if respond_to? :acts_as_journalized
:timestamp => "#{table_name}.updated_on", acts_as_journalized :activity_find_options => {:include => [:project, :author]},
:author_key => :author_id :activity_timestamp => "#{table_name}.updated_on",
:activity_author_key => :author_id
else
acts_as_activity_provider :find_options => {:include => [:project, :author]},
:timestamp => "#{table_name}.updated_on",
:author_key => :author_id
end
validates_presence_of :subject, :project, :author, :kind validates_presence_of :subject, :project, :author, :kind
validates_length_of :subject, :maximum => 255 validates_length_of :subject, :maximum => 255
@ -148,4 +154,4 @@ class CostObject < ActiveRecord::Base
return "issue cost_object" return "issue cost_object"
end end
end end

Loading…
Cancel
Save