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

前端 未结 5 1510
情话喂你
情话喂你 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:33

    An additional situation where this can come up is in a virtualized environment where the files are being edited on the host operating system, and the guest operating system's file event manager doesn't generate events for file changes.

    A solution for this situation is to comment out the following line in config/environments/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
    

    Thus giving:

    # 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
    

    This forces rails to actually check file modification times instead of expecting to get filesystem events.

提交回复
热议问题