Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 539
Proz1g Avatar asked Oct 19 '25 10:10

Proz1g


1 Answers

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!

like image 69
Proz1g Avatar answered Oct 21 '25 01:10

Proz1g



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!