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