让 Rails 2.3.5 感知 Rails 引擎视图路径
如果你的插件有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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我只需要重新启动即可。这是通过我在嵌套应用程序中定义适当的视图目录自动完成的。
杜尔!
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!