The reason you have to restart your server when you make changes is not because of application caching. In fact, according to the helpful Rails caching guide, caching doesn't even take place in development/test environments by default. The real reason you have to restart your server is because one of the jobs of starting a server is to load the Rails application code. And whatever changes you make to the Rails application files doesn't change the currently loaded code. Thus, you need to reload the code by restarting the server.
However, there are alternatives: A gem called spring
, is specifically designed to address the issue of development application reloading (it comes as a standard gem with Rails 4):
- Totally automatic; no need to explicitly start and stop the background process
- Reloads your application code on each run
- Restarts your application when configs / initializers / gem dependencies are changed
This way, your application is reloaded each time you make a change to your application
Just put this in your Gemfile
gem "spring", group: :development
and then run,
$ bundle install
$ bundle exec spring binstub --all
Also, make sure that caching is off when it comes to your browser(s).