module Wisper::ActiveRecord::Publisher

ActiveRecord extension to automatically publish events for CRUD lifecycle see github.com/krisleech/wisper/wiki/Rails-CRUD-with-ActiveRecord see github.com/krisleech/wisper-activerecord

Public Instance Methods

broadcast(*args) click to toggle source
Calls superclass method
# File lib/wisper_plus.rb, line 21
def broadcast(*args)
  super
end
Also aliased as: publish
publish(*args)
Alias for: broadcast

Protected Instance Methods

broadcast_create() click to toggle source

broadcast MODEL_created event to subscribed listeners

# File lib/wisper_plus.rb, line 29
def broadcast_create
  broadcast(:after_create, self)
end
broadcast_destroy() click to toggle source

broadcast MODEL_destroyed to subscribed listeners pass a serialized version of the object attributes for listeners since the object is no longer accessible in the database

# File lib/wisper_plus.rb, line 43
def broadcast_destroy
  broadcast(:after_destroy, attributes.with_indifferent_access)
end
broadcast_update() click to toggle source

broadcast MODEL_updated event to subscribed listeners pass the set of changes for background jobs to know what changed see github.com/krisleech/wisper-activerecord/issues/17

# File lib/wisper_plus.rb, line 36
def broadcast_update
  broadcast(:after_update, self) if self.saved_changes?
end