为什么rails-2.3.5在开发模式下无法重新加载应用程序下的某些文件?

发布于 2024-09-16 04:20:48 字数 344 浏览 3 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦明 2024-09-23 04:20:48

哦。我应该加载文件,而不是需要它们。

我仍然想让它们神奇地加载——不需要为每个加载声明一个特定的加载语句——但现在它正在工作:)

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 :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文