Rails Server needs restart every time I make changes? why?

前端 未结 5 1525
情话喂你
情话喂你 2020-12-13 08:37

Every time I change anything in controller\'s or in models, I have to restart the server for it to take effect.But that wasn\'t always the case, it used to work normally bef

5条回答
  •  一整个雨季
    2020-12-13 09:18

    There is a good note for VirtualBox users, posted as comment by user Ninjaxor:

    For Vagrant/ virtual box users, there's a bug where if the host clock and guest clock are out of sync, it borks rails' reloader. https://github.com/rails/rails/issues/16678

    The file Vagrantfile you find in a directory like this: .../ruby/gems/sass-3.4.22/vendor/listen

    There you have to add this:

    # Sync time every 5 seconds so code reloads properly
    config.vm.provider :virtualbox do |v|
      v.customize ["guestproperty", "set", :id, "--timesync-threshold", 5000]
    end
    

    Thanks to user axsuul on GitHub!

提交回复
热议问题