试图从宝石中调用视图 [英] Trying to call view from gem

查看:98
本文介绍了试图从宝石中调用视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始使用Rails。
我开发了一个ruby gem,包含一些动态变量的视图,我想从我的rails项目中调用具体的视图。
您有任何方法可以做到这一点吗?

感谢您的帮助。

解决方案

希望以下内容能够帮助您如何在Rails框架中呈现视图!



http://guides.rubyonrails.org/layouts_and_rendering.html



另外,关于获取gem中的视图,看起来好像如果您在gem的底部使用'app / views /'存储视图,则rails应该选择该视图,以便随后在呈现视图时这就好像你只是在应用程序的views目录中有文件一样!



希望这有助于!

I'm just beginning working with Rails. Ive developed a ruby gem including views with some dynamic variables and i would like to call specific view from my rails project. Do you have any approach to do that please?

Thanks for you help.

解决方案

Hope the following will help with how to 'render' a view within the rails framework!

http://guides.rubyonrails.org/layouts_and_rendering.html

Also, with regard to getting a hold of the views in the gem, it looks like if you have the views stored with 'app/views/' at the base of the gem, rails should pick that up so that subsequently when you render the view it would be as if you simply had the file within the views directory of the app!

Hope this helps!

这篇关于试图从宝石中调用视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆