Trying to call view from gem

喜你入骨 提交于 2019-12-24 16:41:50

问题


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.


回答1:


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!



来源:https://stackoverflow.com/questions/26167844/trying-to-call-view-from-gem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!