2

I'm using Spring 1.1.3 with the default Polling Watcher in a Rails 4.1.4 application. Now I'd like to give the event-based file system listener a try, but can't figure out how to configure this properly.

When adding the listen Gem (1.3.1) to the Gemfile and setting Spring.watch_method = :listen in an initializer, the Watcher doesn't change. Checking Spring.watcher will return an instance of Spring::Watcher::Polling.

So, where's the right place to configure this?

Baldrick
  • 23,882
  • 6
  • 74
  • 79
tbuehlmann
  • 9,032
  • 5
  • 27
  • 33

1 Answers1

1

To configure Spring before Rails loads, set Spring.watch_method = :listen in config/spring.rb. Setting it in an app initializer is too late—you've already "sprung" by then.

Jeremy Kemper
  • 306
  • 3
  • 4
  • Perfect, thank you! While trying your suggested method I stumbled over https://github.com/jonleighton/spring-watcher-listen, which also works like a charm. – tbuehlmann Dec 09 '14 at 10:36