aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/notifications
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/notifications')
-rw-r--r--activesupport/lib/active_support/notifications/fanout.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb
index 48ccb156ae..6e4ff40dc3 100644
--- a/activesupport/lib/active_support/notifications/fanout.rb
+++ b/activesupport/lib/active_support/notifications/fanout.rb
@@ -10,8 +10,9 @@ module ActiveSupport
def subscribe(pattern = nil, &block)
@listeners_for.clear
- @subscribers << Subscriber.new(pattern, &block)
- @subscribers.last
+ Subscriber.new(pattern, &block).tap do |s|
+ @subscribers << s
+ end
end
def unsubscribe(subscriber)