问题
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