lib/reactor/models/concerns/publishable.rb in reactor-0.7.0 vs lib/reactor/models/concerns/publishable.rb in reactor-0.7.1

- old
+ new

@@ -1,11 +1,12 @@ module Reactor::Publishable extend ActiveSupport::Concern included do after_commit :schedule_events, if: :persisted?, on: :create - after_commit :schedule_conditional_events, if: :persisted?, on: [:create, :update] + after_commit :schedule_conditional_events_on_create, if: :persisted?, on: :create + after_commit :schedule_conditional_events_on_update, if: :persisted?, on: :update after_commit :reschedule_events, if: :persisted?, on: :update end def publish(name, data = {}) Reactor::Event.publish(name, data.merge(actor: self) ) @@ -54,9 +55,11 @@ send(ifarg) end Reactor::Event.publish name, event if need_to_fire end end + alias :schedule_conditional_events_on_create :schedule_conditional_events + alias :schedule_conditional_events_on_update :schedule_conditional_events def event_data_for_signature(signature) signature.merge( actor: (signature[:actor] ? send(signature[:actor]) : self), target: (signature[:target] ? self : nil),