|
|
|
@ -15,21 +15,23 @@ class JournalsForMessage < ActiveRecord::Base
|
|
|
|
|
"m_reply_id" # 回复某留言的留言id(a留言回复了b留言,这是b留言的id)
|
|
|
|
|
acts_as_tree :foreign_key => 'm_parent_id', :counter_cache => :m_reply_count, :order => "#{JournalsForMessage.table_name}.created_on ASC"
|
|
|
|
|
|
|
|
|
|
belongs_to :project, :foreign_type => 'jour_type', :foreign_key => 'jour_id', :polymorphic => true
|
|
|
|
|
belongs_to :project,
|
|
|
|
|
:foreign_key => 'jour_id',
|
|
|
|
|
:conditions => "#{self.table_name}.jour_type = 'Project' "
|
|
|
|
|
|
|
|
|
|
belongs_to :jour, :polymorphic => true
|
|
|
|
|
belongs_to :user
|
|
|
|
|
belongs_to :at_user, :class_name => "User", :foreign_key => 'reply_id'
|
|
|
|
|
|
|
|
|
|
acts_as_event :title => Proc.new {|o| "#{l(:label_my_message)}"},
|
|
|
|
|
:datetime => :updated_on,
|
|
|
|
|
:datetime => Proc.new {|o| o.updated_on },
|
|
|
|
|
:author => Proc.new {|o| o.user },
|
|
|
|
|
:description => Proc.new{|o| o.notes },
|
|
|
|
|
:type => Proc.new {|o| o.jour_type }#,
|
|
|
|
|
#:url => Proc.new {|o| ''}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
|
|
|
|
acts_as_activity_provider :author_key => :author_id,
|
|
|
|
|
:func => 'memos',
|
|
|
|
|
:timestamp => 'updated_on',
|
|
|
|
|
:find_options => {}#:include => :project}
|
|
|
|
|
acts_as_activity_provider :author_key => :user_id,
|
|
|
|
|
:timestamp => "#{self.table_name}.updated_on",
|
|
|
|
|
:find_options => {:include => :project }
|
|
|
|
|
|
|
|
|
|
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
|
|
|
|
|
|
|
|
|