Module: Pheromone::Publishable::ClassMethods

Defined in:
lib/pheromone/publishable.rb

Overview

class methods for the model including Publishable

Instance Method Summary collapse

Instance Method Details

#publish(message_options) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/pheromone/publishable.rb', line 37

def publish(message_options)
  errors = Pheromone::Validators::OptionsValidator.new(
    message_options
  ).validate
  raise Pheromone::Exceptions::InvalidPublishOptions.new(errors) unless errors.empty?
  __send__(:after_commit, proc { dispatch_messages(message_options: message_options) })
end