Rails 5 restart server every time controller or model changes
Asked Answered
E

1

7

I have a vagrant box(ubuntu xenial) with my rails (5.0.0.1) development server and every time I change a model or a controller I need to restart the server.

I've tested with puma and webrick and the behavior is the same.

I do the development in my host machine which is a Windows 10 machine, vagrant creates a shared folder where I have my code.

I've checked if both the VM machine and my host are in sync in terms of time and they appear to be. Another thing that I did was to check other threads here in SO regarding similar problems but I had no luck with the suggestions given.

Does anyone have any ideas about what might be the problem?

Ethelynethene answered 9/12, 2016 at 18:53 Comment(2)
Sounds like a config issue. Is cache_classes set to false in your dev configs? Either in app/config/environments/development.rb or in app/config/application.rbConversant
Yes my development.rb file has config.cache_classes = falseJellybean
E
14

I've resolved the problem, I stumbled upon this post Vagrant shared folder with rails server which pointed me to the right direction.

Basicallly besides having:

config.cache_classes = false

in the development.rb file it is also necessary to have:

config.reload_classes_only_on_change = false
Ethelynethene answered 9/12, 2016 at 19:35 Comment(1)
this answer might help as well config.file_watcher = ActiveSupport::FileUpdateCheckerWilfredowilfrid

© 2022 - 2024 — McMap. All rights reserved.