Rails 3.2 ships with a simple FileWatcher that only reloads your app if any of the files changed.
Besides, it also provides a mechanism to hook up your own file watcher mechanism, so we can use tools like FSSM that hooks into Mac OS X fsevents and does the hard work for us. This is an example on how to hook your own mechanism (you need Rails master, soon to be Rails 3.2):
-
Copy the
2_file_watcher.rb
file below tolib/file_watcher.rb
-
Add the following inside your Application in
config/application.rb
if Rails.env.development? require "file_watcher" config.file_watcher = FileWatcher end
-
Add to your
Gemfile
group :development do gem "fssm" end
-
Profit!
More information about this behavior can be read on ActiveSupport::FileUpdateChecker
Note: if you are using Windows (or any operating system that does not have filesystem events supported by FSSM), you should stick with Rails implementation as it is checks for timestamps just when required instead of having a pooling thread.