今天发现应用的 autoload 功能失效了,每次修改了 controller/model 文件都必须要重启 rails server 才能生效,rails config 如下:
#Rails 3.2.13
#RAILS_ENV=development
@autoload_once_paths=[],
@autoload_paths=
["APP_PATH/app/models/role.rb",
"APP_PATH/app/models/user.rb",
"APP_PATH/app/models/ability.rb",
"APP_PATH/app/models/product.rb",
"APP_PATH/app/components"],
@cache_classes=false,
@consider_all_requests_local=true,
@dependency_loading=true,
@eager_load_paths=
["APP_PATH/app/assets",
"APP_PATH/app/controllers",
"APP_PATH/app/helpers",
"APP_PATH/app/mailers",
"APP_PATH/app/models",
"APP_PATH/app/worker"],
@encoding="utf-8",
查了 ActiveSupport::Dependencies 的加载,发现只有在启动 serve 时加载过相关文件,后面在请求就不再走其流程了. 由谁遇到过?或者告诉怎样排查也可以。多谢了。