Skip to content

Commit

Permalink
Minor fix to allow counter decrement
Browse files Browse the repository at this point in the history
  • Loading branch information
Michaelvilleneuve committed Dec 8, 2023
1 parent 7d6d86f commit 09ebe50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/statisfy/subscriber.rb
@@ -1,4 +1,3 @@
require "pry"
module Statisfy
module Subscriber
def self.included(klass)
Expand All @@ -21,11 +20,12 @@ def append_callback_to_model(model, event)
statisfy_counter = lambda {
counter = listener.new
counter.subject = self
counter.params = attributes
counter
}

trigger_event = lambda { |statisfy_trigger|
if listener.respond_to?(Statisfy.configuration.default_async_method)
if listener.respond_to?(Statisfy.configuration.default_async_method) && statisfy_trigger != :destroy
listener.send(Statisfy.configuration.default_async_method, attributes.merge(statisfy_trigger:))
else
instance_exec(&statisfy_counter).perform(attributes.merge(statisfy_trigger:))
Expand Down

0 comments on commit 09ebe50

Please sign in to comment.