lib/reactor/event.rb in reactor-0.6.2 vs lib/reactor/event.rb in reactor-0.7.0
- old
+ new
@@ -83,16 +83,12 @@
def initialize_polymorphic_association(method)
data["#{method}_type"].constantize.find(data["#{method}_id"])
end
def fire_database_driven_subscribers(data, name)
- Reactor::Subscriber.where(event: name).each do |subscriber|
- Reactor::Subscriber.delay.fire subscriber.id, data
- end
-
#TODO: support more matching?
- Reactor::Subscriber.where(event: '*').each do |s|
- Reactor::Subscriber.delay.fire s.id, data
+ Reactor::Subscriber.where(event_name: [name, '*']).each do |subscriber|
+ Reactor::Subscriber.delay.fire subscriber.id, data
end
end
def fire_block_subscribers(data, name)
((Reactor::SUBSCRIBERS[name.to_s] || []) | (Reactor::SUBSCRIBERS['*'] || [])).each { |s| s.perform_where_needed(data) }