From 0638509d53dd3a503ff20dedd0e5f7a2e133deeb Mon Sep 17 00:00:00 2001 From: Alexandru-Emil Lupu Date: Sat, 30 May 2020 11:00:51 +0300 Subject: [PATCH] Fixing #29 --- lib/wisper/active_record/publisher.rb | 6 +++++- lib/wisper/active_record/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/wisper/active_record/publisher.rb b/lib/wisper/active_record/publisher.rb index 8eec701..75b4efa 100644 --- a/lib/wisper/active_record/publisher.rb +++ b/lib/wisper/active_record/publisher.rb @@ -25,21 +25,25 @@ def after_validation_broadcast def after_create_broadcast broadcast(:after_create, self) + return unless broadcast_model_name_key broadcast("create_#{broadcast_model_name_key}_successful", self) end def after_update_broadcast broadcast(:after_update, self) + return unless broadcast_model_name_key broadcast("update_#{broadcast_model_name_key}_successful", self) end def after_destroy_broadcast broadcast(:after_destroy, self) + return unless broadcast_model_name_key broadcast("destroy_#{broadcast_model_name_key}_successful", self) end def after_commit_broadcast broadcast(:after_commit, self) + return unless broadcast_model_name_key broadcast("#{broadcast_model_name_key}_committed", self) end @@ -48,7 +52,7 @@ def after_rollback_broadcast end def broadcast_model_name_key - self.class.model_name.param_key + self.class.model_name.param_key rescue false end end end diff --git a/lib/wisper/active_record/version.rb b/lib/wisper/active_record/version.rb index 4ab8f5a..c9a4d21 100644 --- a/lib/wisper/active_record/version.rb +++ b/lib/wisper/active_record/version.rb @@ -1,5 +1,5 @@ module Wisper module ActiveRecord - VERSION = "1.0.0" + VERSION = "1.0.1" end end