5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/multiple_man/mixins/publisher.rb', line 5
def Publisher.included(base)
base.extend(ClassMethods)
if base.respond_to?(:after_commit)
base.after_commit(on: :create) { |r| r.multiple_man_publish(:create) }
base.after_commit(on: :update) do |r|
if !r.respond_to?(:previous_changes) || r.previous_changes.any?
r.multiple_man_publish(:update)
end
end
base.after_commit(on: :destroy) { |r| r.multiple_man_publish(:destroy) }
end
base.class_attribute :multiple_man_publisher
end
|