让 Rails 2.3.5 感知 Rails 引擎视图路径

发布于 2024-08-14 05:25:49 字数 546 浏览 2 评论 0原文

根据 Ruby on Rails 2.3 发行说明...

如果你的插件有app文件夹,那么app/[models|controllers|helpers]会自动添加到Rails加载路径中。引擎现在还支持添加视图路径,ActionMailer 和 Action View 将使用来自引擎和其他插件的视图。

在 2.3 中,应该有某种方法可以让 Rails 知道 Rails 引擎的应用程序/视图。然而,我似乎找不到关于此功能如何真正工作的文档。

谁能帮助我让我的视图路径在 Rails Engine 场景的上下文中工作?

重要提示:最大的问题不在于视图,而在于部分视图。我需要能够从 Rails 引擎的视图路径加载部分内容。

谢谢!!

According to the Ruby on Rails 2.3 Release Notes...

if your plugin has an app folder, then app/[models|controllers|helpers] will automatically be added to the Rails load path. Engines also support adding view paths now, and ActionMailer as well as Action View will use views from engines and other plugins.

There is supposed to be some way to make Rails aware of the app/views of your Rails engine, in 2.3. However, there is virtually no documentation on how this feature really works, that I can seem to find.

Can anyone help me get my view paths working from the context of a Rails Engine scenario?

IMPORTANT: The big issue is not with views as much as it is with partials. I need to be able to load partials from the view path of a rails engine.

Thanks!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

﹎☆浅夏丿初晴 2024-08-21 05:25:49

事实证明,我只需要重新启动即可。这是通过我在嵌套应用程序中定义适当的视图目录自动完成的。

杜尔!

Turns out, I just needed to restart. This is done automatically by virtue of me defining a proper views directory within the nested app.

Durr!

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