简体   繁体   English

如何在Rails 2.3中强制重新加载所有供应商/插件(开发模式)

[英]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.

相关问题 如何在开发模式下强制Rails 3.2按请求重新加载已安装的机架应用程序? - How can I force Rails 3.2 to reload mounted rack app per request in development mode? 在开发模式下重新加载Rails 3初始化程序 - Reload Rails 3 initializer in development mode 如何让Rails 3在开发模式下重新加载STI类? - How to make Rails 3 reload STI classes in development mode? 在开发模式下重新加载gem和插件的Rails问题 - Rails issue with reloading gems and plugins in development mode 部署到Heroku时出错(DEPRECATION警告:您在供应商/插件中有Rails 2.3样式的插件) - Error deploying to Heroku (DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins) heroku拒绝了带有警告的git push“弃用警告:供应商/插件中有Rails 2.3样式的插件”和 - heroku rejected git push with warnings “ DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins” and Rails不在开发模式下的Rails 4.0.x中找到供应商/资产吗? - Rails is not finding vendor/assets in Rails 4.0.x in development mode? 开发模式下的rails 2.3 config.load_paths - rails 2.3 config.load_paths in development mode 如何在 Rails 的开发模式下为每个请求自动重新加载 gem 代码? - How can I automatically reload gem code on each request in development mode in Rails? 升级到rails 3.2.1后如何处理供应商/插件 - How to deal with vendor/plugins after upgrading to rails 3.2.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM