Skip to content

Global listeners and Spring

jmarceli edited this page Apr 28, 2016 · 1 revision

In order to use Rails Spring with Wisper global listeners e.g.

config/initializers/wisper.rb (global listener example)

Wisper.subscribe(SomeObserver.new)

you have to change config/initializers/wisper.rb and force listeners clearing on each request.

Rails.application.config.to_prepare do
  Wisper.clear if Rails.env.development? || Rails.env.test?
  Wisper.subscribe(SomeObserver.new)
end

For more info see: http://stackoverflow.com/questions/36899306/rails-spring-wisper-listener-method-caching/36908999