Need to recompile assets in Rails in case of change. How do I get rid of it?
ruby, ruby-on-rails
Solution
Every time you run the `assets:precompile` Rails place compiled assets into `public/assets`. The issue is that the assets pipeline will always serve an asset from the `public` directory if it founds it here. Otherwise it will search assets in the `app/assets` directory which is the appropriate location for assets in development.
You're not supposed to precompile assets in your development environment, assets precompilation is for production environments. If you want to do it periodically, for example to check compiled/minified assets, don't forget to remove the `public/assets` directory once you're done.
Problem
I have a Rails application. Here is the part of the content of development.rb ``` config.assets.debug = true config.assets.compress = false ``` When I change any `js` file, I have to call `RAILS_ENV=development rake assets:precompile` to see the changes. I wonder why? How do I get rid of that? I want just to save `javascript` file and not to do any extra work. P.S. It's not only about javascript files. Even when I change a haml file, I also have to call `RAILS_ENV=development rake assets:precompile`.