I’m a little confused about render, not quite sure which path it chooses to link.
According to docs:
http://guides.rubyonrails.org/layouts_and_rendering.html#using-render
we can have explicit link:
render "/u/apps/warehouse_app/current/app/views/products/show"
But, in /apps/view/layouts/application.html.erb if I have shims for _header and _footer, I have to go:
render 'layout/header'
so it looks for path starting from ../app/view/ then appends layout/_header.html.erb to fetch the file. But in the rule listed on rubyonrails.org using explicit link, indicated by leading /, has a path starting from the root folder (/u/apps/…).
So my question is when using render with leading / which is the starting director? Is it always root, and layout is just an exception to the rule?
Thanks
I think you miss this point. The render method can also use a view that’s entirely outside of your application (perhaps you’re sharing views between two Rails applications):
Rails determines that this is a file render because of the leading slash character.
In general if you are adding a view file from another controller it takes as
it will take the path till view folder automatically. And for layout you can same as above