ruby-on-rails - 每次进行更改时,Rails Server 都需要重新启动吗?为什么?

标签 ruby-on-rails

每次我更改 Controller 或模型中的任何内容时,我都必须重新启动服务器才能生效。但情况并非总是如此,以前当我更改任何内容时它都可以正常工作,但我不这样做不知道现在发生了什么?

我的 Rails 版本是 3.2.11

在我的开发环境文件中,我设置了 config.cache_classes = false。

请帮忙..

我的development.rb文件如下

Testapp::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # In the development environment your application's code is reloaded on
  # every request. This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Log error messages when you accidentally call methods on nil.
  config.whiny_nils = true

  # Show full error reports and disable caching
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger
  config.active_support.deprecation = :log

  # Only use best-standards-support built into browsers
  config.action_dispatch.best_standards_support = :builtin

  # Raise exception on mass assignment protection for Active Record models
  config.active_record.mass_assignment_sanitizer = :strict

  # Log the query plan for queries taking more than this (works
  # with SQLite, MySQL, and PostgreSQL)
  config.active_record.auto_explain_threshold_in_seconds = 0.5

  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }

end

最佳答案

我已经得到答案了..

在我的 config/environments/development.rb 文件中添加以下行后,我的问题已得到解决。

config.reload_classes_only_on_change = false

关于ruby-on-rails - 每次进行更改时,Rails Server 都需要重新启动吗?为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18270945/

相关文章:

ruby-on-rails - 使用 pg_search 搜索特殊字符

ruby-on-rails - exslt 功能在 ruby​​-xslt gem 中不起作用

ruby-on-rails - 如何在 simple_form 中生成取消按钮?

ruby-on-rails - Cancan嵌套路由限制对:index的访问

ruby-on-rails - Rails,删除查询中事件记录值周围的引号

ruby-on-rails - 在 Ruby 调试中,只单步执行应用程序/项目文件并跳过框架文件?

ruby-on-rails - Rails ransack gem 以键值对作为参数搜索 jsonb 列

ruby-on-rails - Windows 上的 Rails 部署环境

ruby-on-rails - Rails 4 通过方法查找或创建不起作用

ruby-on-rails - 如何一次获取多个哈希值?