ruby-on-rails – 在FreeBSD 9.1中,Rails不会为每个请求重新加载控制器,助手

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在FreeBSD 9.1中,Rails不会为每个请求重新加载控制器,助手前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已经检测到铁轨的奇怪行为.请给我一些建议!

例如,我有这样的代码

  1. def new
  2. raise
  3. end

我在开发模式下启动rails服务器.
在浏览器中点击刷新并查看

RuntimeError in AuthenticationController#new

好的.我评论出与“加注”这样的行:

  1. def
  2. # raise
  3. end

在浏览器中点击刷新,但我再次看到如上所示的错误.即使在浏览器中我看到代码注释掉“加注”.

我的猜测是控制器和帮助器等正在重新加载,但rails返回缓存结果.

配置/环境/ development.rb:

  1. Rails.application.configure do
  2. # BetterErrors::Middleware.allow_ip! '192.168.78.0/16'
  3.  
  4. # In the development environment your application's code is reloaded on
  5. # every request. This slows down response time but is perfect for development
  6. # since you don't have to restart the web server when you make code changes.
  7. config.cache_classes = false
  8.  
  9. # Do not eager load code on boot.
  10. config.eager_load = false
  11.  
  12. # Show full error reports and disable caching.
  13. config.consider_all_requests_local = true
  14. config.action_controller.perform_caching = false
  15.  
  16. # Don't care if the mailer can't send.
  17. config.action_mailer.raise_delivery_errors = false
  18.  
  19. # Print deprecation notices to the Rails logger.
  20. config.active_support.deprecation = :log
  21.  
  22. # Raise an error on page load if there are pending migrations.
  23. config.active_record.migration_error = :page_load
  24.  
  25. # Debug mode disables concatenation and preprocessing of assets.
  26. # This option may cause significant delays in view rendering with a large
  27. # number of complex assets.
  28. config.assets.debug = true
  29.  
  30. # Asset digests allow you to set far-future HTTP expiration dates on all assets,# yet still be able to expire them through the digest params.
  31. config.assets.digest = true
  32.  
  33. # Adds additional error checking when serving assets at runtime.
  34. # Checks for improperly declared sprockets dependencies.
  35. # Raises helpful error messages.
  36. config.assets.raise_runtime_errors = false
  37.  
  38. # Raises error for missing translations
  39. # config.action_view.raise_on_missing_translations = true
  40. end

我如何启动服务器:

  1. => Booting Puma
  2. => Rails 4.2.1.rc3 application starting in development on http://0.0.0.0:3000
  3. => Run `rails server -h` for more startup options
  4. => Ctrl-C to shutdown server
  5. Puma 2.11.1 starting...
  6. * Min threads: 0,max threads: 16
  7. * Environment: development
  8. * Listening on tcp://0.0.0.0:3000

请给我任何建议.

更新1.
这个问题在Ubuntu 14.04中不存在,但存在于FreeBSD 9.1中.

我已经创建了简单的应用程序并在FreeBSD中首先测试它(同样的问题),然后在Ubuntu中测试(没问题).

你能帮我提一下如何在FreeBSD 9.1上解决这个问题吗?

解决方法

与Rails 5 Vagrant Ubuntu 16有同样的问题.上述解决方案均无效(我的访客和主机时间已同步).

唯一对我有用的是从config / environments / development.rb中注释掉以下行

config.file_watcher = ActiveSupport :: EventedFileUpdateChecker

以为我会发布这个以防万一其他人到这个页面寻找类似的问题,就像我做的那样.

猜你在找的Ruby相关文章