Sidebars should be placed in the main layout or the action's view

Just wondering. Should sidebars be in the view or in the main layout?

If they are in the main layout. i.e. with the following code:

      <div class="span-24">

        <div id="content" class="span-18">

            <%= yield %>


        <div id="side-panel" class="span-6 last">




If the sidebar has dynamic content (i.e. data being set from the
action), how can this be displayed? So I am thinking that the sidebar
must be in the action's view.

What are your thoughts? What is the rails way of doing this? Or
perhaps, is there a plugin that one can use?

Ok, I found out a better solution. Using <%= yield :side_panel %> in
main layout and

<% content_for :side_panel do %><%= render :partial =>
'side_panel_show', :object_topass => @object_topass %><% end %>