Module: MuckServices::Models::MuckServicesComment

Extended by:
ActiveSupport::Concern
Defined in:
lib/muck-services/models/services_comment.rb

Instance Method Summary collapse

Instance Method Details

#after_createObject


8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/muck-services/models/services_comment.rb', line 8

def after_create
  if self.commentable.is_a?(Entry)
    return if self.user.blank?
    # Create a new entry_comment activity.  Attach the activity to the entry via self.commentable
    # Include all users in the discussion ie all users from all comments attached to self.commentable
    feed_to = []
    feed_to << self.user.feed_to
    self.commentable.comments.each do |c|
      feed_to << c.user if !c.user.blank?
    end
    add_activity(feed_to, self.user, self, 'entry_comment', '', '', nil, self.commentable)
  end
end