为什么rails-2.3.5在开发模式下无法重新加载应用程序下的某些文件?
我在 Railscast #101 之后添加了一个子目录 app/renderers
。我的开发服务器没有重新加载该目录中的类。这让我有点发疯。
我已经阅读了所有我能找到的关于强制它重新加载库和/或插件的内容,但这似乎是一个不同的情况,因为“应用程序下的所有内容都应该自动重新加载。”另外,我检查了 ActiveSupport::Dependency.load_once_paths
,并且 app/renderers
绝对不在其中。
我还想让渲染器自动成为必需的,这样我就不必在代码的其余部分中添加 require 语句。这明智吗?例如,它如何适用于模型和其他常量?
I've added a subdirectory app/renderers
after Railscast #101. The classes in that directory are not getting reloaded by my development server. It's driving me a little bonkers.
I've read everything I could find on forcing it to reload lib and/or plugins but this seems to be a different case since "everything under app should be reloaded automatically." Plus, I've checked ActiveSupport::Dependencies.load_once_paths
, and app/renderers
definitely isn't in it.
I'd also like to get the renderers to be automatically required, so that I don't have to go around putting require statements in the rest of my code. Is that sensible? How does it work for, say, models and other constants?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哦。我应该加载文件,而不是需要它们。
我仍然想让它们神奇地加载——不需要为每个加载声明一个特定的加载语句——但现在它正在工作:)
Doh. I should have been loading the files, not requiring them.
I'd still like to have them magically loaded -- not needing a specific load statement for each one -- but for now it's working :)