Skip to content

Commit

Permalink
Use Spree::Event.subscribe_subscribers! when available
Browse files Browse the repository at this point in the history
The new method `Spree::Event.subscribe_subscribers!` is introduced
in Solidus with solidusio/solidus#3758 as a better way to subscribe
event subscribers: under the hood, event subscribers use new interal
mappings.

Also, we need to keep around the old interface as well until it won't
be supported anymore in Solidus.
  • Loading branch information
spaghetticode committed Sep 25, 2020
1 parent 1f2b80b commit 78cc32a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/solidus_support/engine_extensions.rb
Expand Up @@ -36,7 +36,12 @@ def load_solidus_subscribers_from(path)
path.glob("**/*_subscriber.rb") do |subscriber_path|
require_dependency(subscriber_path)
end
Spree::Event.subscribers.each(&:subscribe!)

if Spree::Event.respond_to?(:subscribe_subscribers!)
Spree::Event.subscribe_subscribers!
else
Spree::Event.subscribers.each(&:subscribe!)
end
end
end

Expand Down

0 comments on commit 78cc32a

Please sign in to comment.