Sha256: b4fdc5dd0dad6854913fadcd77cffeceb32e838509567ec5889ffd4b327ebcda

Contents?: true

Size: 1.11 KB

Versions: 32

Compression:

Stored size: 1.11 KB

Contents

module ActiveRecord
  module Acts #:nodoc:
    module MuckRakerComment # :nodoc:

      def self.included(base)
        base.extend(ClassMethods)
      end
  
      module ClassMethods

        def acts_as_muck_raker_comment(options = {})
          include ActiveRecord::Acts::MuckRakerComment::InstanceMethods
          extend ActiveRecord::Acts::MuckRakerComment::SingletonMethods
        end
      end
      
      # class methods
      module SingletonMethods
      end

      module InstanceMethods
        
        def after_create
          if self.commentable.is_a?(Entry)
            # 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
      end
      
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
muck-raker-0.2.11 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.10 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.9 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.8 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.7 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.6 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.5 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.4 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.3 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.2 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.2.0 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.49 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.48 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.47 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.46 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.45 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.43 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.42 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.41 lib/active_record/acts/muck_raker_comment.rb
muck-raker-0.1.40 lib/active_record/acts/muck_raker_comment.rb