[英]How to force reload all vendor/plugins in rails 2.3 (development mode)
We have an application with a app/model that references another model stored in a plugin. 我们有一个带有应用程序/模型的应用程序,该应用程序/模型引用了存储在插件中的另一个模型。
When the app/model level is reloaded on the second and further requests and that relies on our model in vendor/plugins/... (which stays loaded) it fails (can't dup nil class). 当应用程序/模型级别在第二个请求和其他请求上重新加载,并且依赖于我们在vendor / plugins / ...中的模型(保持加载状态)时,它将失败(无法dup nil类)。
We've tried setting config.reload_plugins = true
in the development.rb but this doesn't seem to do it. 我们已经尝试在development.rb中设置
config.reload_plugins = true
,但这似乎没有做到。
Does anybody know a way to handle this? 有人知道解决这个问题的方法吗?
It's an ugly problem. 这是一个丑陋的问题。 My solution has been to keep the actual model lightweight and in the expected
app/models
directory. 我的解决方案是保持实际模型的轻量化,并使其位于预期的
app/models
目录中。 Extract the code you want to share amongst applications and roll it into a module that you keep in your plugin. 提取要在应用程序之间共享的代码,并将其滚动到插件中保留的模块中。 Include the module in your models.
将模块包括在模型中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.