O'Reilly logo

Crafting Rails 4 Applications, 2nd Edition by José Valim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filesystem Notifications with Threads

A Rails application is generated with three assets directories by default: app/assets, lib/assets, and vendor/assets. Our assets should be split between those directories in the same way we’d split our code: the app directory should contain assets related directly to our application, the lib directory should hold isolated JavaScript or stylesheet components that would be useful beyond our application, and the vendor directory should contain third-party files.

We’d like to watch for filesystem changes in each of these directories. One option is to manually check the modification time of each file in those directories every second or less. This is filesystem polling. Polling may be a good starting point, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required