试图从宝石中调用视图 [英] Trying to call view from gem
问题描述
我刚刚开始使用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屋!