module Wisper::Mongoid::Publisher

Broadcasts Wisper events when Mongoid records are saved.

Private Instance Methods

after_create_broadcast() click to toggle source
# File lib/wisper/mongoid/publisher.rb, line 25
def after_create_broadcast
  broadcast(:after_create, self)
  broadcast("create_#{broadcast_model_name_key}_successful", self)
end
after_destroy_broadcast() click to toggle source
# File lib/wisper/mongoid/publisher.rb, line 35
def after_destroy_broadcast
  broadcast(:after_destroy, self)
  broadcast("destroy_#{broadcast_model_name_key}_successful", self)
end
after_update_broadcast() click to toggle source
# File lib/wisper/mongoid/publisher.rb, line 30
def after_update_broadcast
  broadcast(:after_update, self)
  broadcast("update_#{broadcast_model_name_key}_successful", self)
end
after_validation_broadcast() click to toggle source
# File lib/wisper/mongoid/publisher.rb, line 20
def after_validation_broadcast
  action = new_record? ? 'create' : 'update'
  broadcast("#{action}_#{broadcast_model_name_key}_failed", self) unless errors.empty?
end
broadcast_model_name_key() click to toggle source
# File lib/wisper/mongoid/publisher.rb, line 40
def broadcast_model_name_key
  self.class.model_name.param_key
end