Have simple sidebar code snippet for application.html.erb?

Googled forever trying to find a good example of how to do a simple
sidebar (code snippet) in application.html.erb. I’ve found bits and
pieces, but I need the whole “piece of meat”.

Is anyone willing to share a complete example code snippet for doing a
sidebar? I’m thinking it may involve some new “show” code in the
controller as well?

Your help will be most appreciated!

Thanks rubio

On Wed, Apr 15, 2009 at 9:09 PM, Rob B. <
[email protected]> wrote:

Thanks rubio

Hi, I would recommend taking a look at the “AWDwRails 3rd Edition”
construction
of the depot application section page 91 - 93, section B2: Adding a
Page
Layout.

God luck,

-Conrad

http://pastie.org/private/wcmbr5es6waf50aokxfoig

This is from a real app

On Apr 15, 9:09 pm, Rob B. [email protected]

or

<%= content_for(:side) %>
<%= yield %>

Then use css to float the side and content to the left with some
with…

Was that what you wanted?

Actually you’d want this…

application.html.erb

<%= yield :sidebar %>
<%= yield %>

show.html.erb

Anything you type here will show in the content div
<% content_for :sidebar do %>
this will show up in the sidebar div
<% end %>

Dave S wrote:

Actually you’d want this…

application.html.erb

<%= yield :sidebar %>
<%= yield %>

show.html.erb

Anything you type here will show in the content div
<% content_for :sidebar do %>
this will show up in the sidebar div
<% end %>

Ok … so that’s the trick! Mucho appreciated Dave; thanks for taking
the time.

rubio

Bharat R. wrote:

The following article teaches you how to create your own sidebars.
This is how I got a good grip on it. The agile web development book
also explains it well. Actually, the sidebar itself is trivial. What
is more important is how to use it in layout files and the intricate
interaction of yield with content_for. Once you understand it, you
should not have any trouble creating your own.

Content for Whom? — err.the_blog

Bharat

Bharat,

Thanks for the great article; I googled all last evening but couldn’t
find anything complete.

Mucho appreciated,
rubio

The following article teaches you how to create your own sidebars.
This is how I got a good grip on it. The agile web development book
also explains it well. Actually, the sidebar itself is trivial. What
is more important is how to use it in layout files and the intricate
interaction of yield with content_for. Once you understand it, you
should not have any trouble creating your own.

Bharat