Module: Warren::BroadcastMessages::ClassMethods

Defined in:
lib/warren/broadcast_messages.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#associated_to_broadcastObject (readonly)

Returns the value of attribute associated_to_broadcast


9
10
11
# File 'lib/warren/broadcast_messages.rb', line 9

def associated_to_broadcast
  @associated_to_broadcast
end

Instance Method Details

#broadcast_via_warrenvoid

This method returns an undefined value.

Records of this type are broadcast via RabbitMQ when a transaction is closed.


16
17
18
# File 'lib/warren/broadcast_messages.rb', line 16

def broadcast_via_warren
  after_commit :queue_for_broadcast
end

#broadcasts_associated_via_warren(*associated) ⇒ void

This method returns an undefined value.

When records of this type are saved, broadcast the associated records

Parameters:

  • associated (Symbol, Array<Symbol>)

    One or more symbols indicating the associations to broadcast.


27
28
29
30
# File 'lib/warren/broadcast_messages.rb', line 27

def broadcasts_associated_via_warren(*associated)
  self.associated_to_broadcast = associated.freeze
  after_save :queue_associated_for_broadcast
end