DEV Community

Chris Garrett
Chris Garrett

Posted on

Rails views not updating locally? This might be why...

We recently upgraded a Rails project from Rails 5 to 6. It was pretty smooth in general, but I noticed in development (with Docker) that views weren't updating with changes - as if they were being cached.

The culprit turned out to be this segment of config/development.rb:

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker

ActiveSupport::EventedFileUpdateChecker dislikes either Docker volumes or Windows - I'm leaning towards the latter and it being a dependency issue relating to FS notifications.

If you're hitting this issue: just comment out the config.file_watcher line and you'll be back on track.

Top comments (6)

beyarz profile image

Thank you for this, but I would not suggest fully commenting it out but instead using config.file_watcher = ActiveSupport::FileUpdateChecker instead.

See the difference here:

samuelaierizer profile image
Samuel Aierizer

This was the case for me too. I was using Windows with WSL2 and this solved it.

safventure23 profile image

This solved my problem. Thank you. :)

agiboire profile image

My savior of the day! 🙏

mkdika profile image
Maikel Chandika like charm! thank you.

mohamedasan profile image
Mohamed Asan N

I was using Docker on MacOS and was trying to fix it hours. I wish I had looked at this solution a lot before 🙏 Thanks a lot 💪