Rails doesn't detect file changes and config.reload_classes_only_on_change makes the server too slow
Asked Answered
R

1

4

First of all I don't know if this is a bug or not. Until now I've been using this command in rails development.rb environment config so the box detects changes on my files:

config.reload_classes_only_on_change = false

But now, with Rails 5.2 and Active Storage that command makes the server a lot slower, and the images takes from 10 to 40sec to load.

Is it a bug? There is another way to make the vagrant/rails detect changes on my files without making me reload the server every time I change something?

Repeated answered 30/5, 2018 at 16:5 Comment(0)
R
10

Solution:

After questioning the owner of the box I've been using, he gave me this alternative that works:

At the bottom of the config/environments/development.rb I did this change:

Find this line at the bottom of the file and comment out:

config.file_watcher = ActiveSupport::EventedFileUpdateChecker

Then add this line:

config.file_watcher = ActiveSupport::FileUpdateChecker

So it looks like this:

# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.file_watcher = ActiveSupport::FileUpdateChecker

Now it works properly and I do not have to use this command anymore:

config.reload_classes_only_on_change = true

Best regards!

Repeated answered 1/6, 2018 at 9:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.