Module: ActiveRecord::Publishable::ClassMethods

Defined in:
lib/active_record/publishable.rb

Instance Method Summary collapse

Instance Method Details

#publishable(options = {}) ⇒ Object



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

def publishable(options = {})
  Array(options.fetch(:on, [:create, :update, :destroy])).each do |verb|
    after_commit options.merge(on: verb) do
      unless ActiveRecord::Publishable.disabled?
        publish_action(verb, options)
      end
    end
  end
end