Module: ActionPubsub::ActiveRecord::Events::Changed

Extended by:
ActiveSupport::Concern
Defined in:
lib/action_pubsub/active_record/events/changed.rb

Instance Method Summary collapse

Instance Method Details

#publish_changed_eventObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/action_pubsub/active_record/events/changed.rb', line 14

def publish_changed_event
  routing_key = [self.class.exchange_prefix, "changed"].join("/")

  record_changed_event = ::ActionPubsub::Event.new(
    :topic => routing_key,
    :record => self
  )

  ::ActiveRecord::Base.connection_pool.with_connection do
    ::ActionPubsub.publish_event(routing_key, record_changed_event)
  end
end