是否可以在开发模式下运行Rails控制台禁用延迟类加载?

时间:2021-04-02 19:01:33

When running Rails console in development mode, Rails will lazy load all of the classes. This can be seen when running:

在开发模式下运行Rails控制台时,Rails将延迟加载所有类。运行时可以看到:

[2] pry(main)> ApplicationController.descendants
=> []

Is it possible to disable the lazy loading of controllers in development mode?

是否可以在开发模式下禁用延迟加载控制器?

1 个解决方案

#1


0  

In config/environments/development.rb, my application had

在config / environments / development.rb中,我的应用程序有

  # Do not eager load code on boot.
  config.eager_load = false

Changing that to true fixed it for me.

将其更改为true可以为我修复它。

#1


0  

In config/environments/development.rb, my application had

在config / environments / development.rb中,我的应用程序有

  # Do not eager load code on boot.
  config.eager_load = false

Changing that to true fixed it for me.

将其更改为true可以为我修复它。