Where is the Rails-way to place view that is not related to any specific controller?

Well, I have a "sidebar" in a website that is rendered inside the main layout. What I want to do is to put the sidebar in a separated file and then call

= render :partial => "sidebar.html.haml"

Just to have them in separated files.

Where is the convention to put it? In the root of /app/views? In /app/views/application? In /app/views/layout? In a separated view folder?

Well, I have a "sidebar" in a website that is rendered inside the main layout. What I want to do is to put the sidebar in a separated file and then call

= render :partial => "sidebar.html.haml"

Just to have them in separated files.

Where is the convention to put it? In the root of /app/views? In /app/views/application? In /app/views/layout? In a separated view folder?

I often have app/views/shared or things like that.

Fred

Frederick Cheung wrote in post #1015986:

I'd rather put them in app/views/layouts since app/views/shared seems a bit vague for me.

"Ruby on Rails 3 Tutorial" puts them in the layouts directory, e.g. layouts/_sidebar.html.erb, which are then inserted with:

<% render 'layouts/sidebar' %>

7stud -- wrote in post #1016015:

"Ruby on Rails 3 Tutorial" puts them in the layouts directory, e.g. layouts/_sidebar.html.erb, which are then inserted into the application layout with:

<% render 'layouts/sidebar' %>

That seems rational, since the scaffolding creates a _form element, thanks ^^

However, when you try to include a partial render from a layout and it is missing you can see that the paths where it search for the view are views/application and views/<controller>.

So I assume that:

shared partial renders should go into views/applications

controller specific partial renders should go into views/<controller>

both should be named with a starting underscore and called without it

however if you wish to render the partial view from another controller you have to select the path calling render <controller>/<partial_view>

At least that's how I'm going to do from now on ^^