Sha256: c514c8758556916d5faa9aee172e19d9c8fcf4e075e0529f056c60ccb7343abe

Contents?: true

Size: 451 Bytes

Versions: 1

Compression:

Stored size: 451 Bytes

Contents

module ActsAsChattable
  module Relation
    attr_accessor :relation_context

    def process(context = self.relation_context, &block)
      self.each do |message|
        block.call(message) if block_given?
        context.delete_message(message)   if message.removed
        context.restore_message(message)  if message.restored
      end
    end

    def conversations
      map { |r| r.root.subtree.order("id desc").first }.uniq
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_chattable-0.0.1 lib/acts_as_chattable/relation.rb