开发者

Universal partial?

I made a partial for a site and my client loved it. It was basically just a sidebar that helps browse the database. Now he wants the sidebar all throughout the site on various pages. So, how can I call a partial from any controller without having to开发者_开发百科 copy and paste the file into each directory.

Thanks in advance!


You could try placing your partial in a folder call shared inside app/views and doing something like:

render :partial => 'shared/sidebar'

where you want to render the partial.


Yes you can:

<%= render "partial_folder/partial_name" %>

Example:

<%= render "layouts/sidebar" %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜