Forum: Ruby on Rails Layout with yield usage?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fdc660c5260e083c1f5fa4a8a7dcdabb?d=identicon&s=25 net (Guest)
on 2008-12-30 23:39
(Received via mailing list)
Hi!

Im having this weird problem when the yield gets overwritten with the
last yield used.. My application layout looks like this:

        <div id="left_sidebar">
            <%= render :partial => "shared/navigation" %>
        </div>

        <div id="main_content">
            <%= yield %>
        </div>

And the output becomes:

        <div id="left_sidebar">
            ### NAVIGATION CONTENT ###
        </div>

        <div id="main_content">
            ### NAVIGATION CONTENT ###    <-- i want this to be ###
MAIN CONTENT ###
        </div>

Am I using layouts/partials incorrectly?
D93ae163042e0a937941e0ba4d8ed5d7?d=identicon&s=25 Eric (Guest)
on 2008-12-31 01:10
(Received via mailing list)
Use <%= yield :navigation %> in your layout instead of the
render :partial, and use content_for :navigation in your view(s).
Watch Railscast 8.

Also, have you checked to see whether your nav render is duplicated in
the view?

-eric
This topic is locked and can not be replied to.