Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 975695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:37:42+00:00 2026-05-16T03:37:42+00:00

What on earth? In posts/_post_brief.html.haml: – title link_to #{post_brief.title} by #{post_brief.user.full_name}, post_brief – content_for

  • 0

What on earth?

In posts/_post_brief.html.haml:

- title link_to "#{post_brief.title} by #{post_brief.user.full_name}", post_brief

- content_for :info do
    - if post_brief.tags.count > 0
        Tags: #{post_brief.tags.collect {|t| t.name}.join(", ")}

- content_for :post_body do
    =post_brief.message

In posts/_post_wrapper.html.haml:

.post
  .right
    %h2= yield :title
    %p.post-info= yield :info
    = yield :post_body
  .left
    %p.dateinfo
      JAN
      %span 31
    .post-meta
      %h4 Playlist Info
      %ul
        %li.user
          %a{:href => "#"} Erwin
        %li.time
          %a{:href => "#"} 12:30 PM
        %li.comment
          %a{:href => "#"} 2 Comments
        %li.permalink
          %a{:href => "#"} Permalink

In posts/index.html.haml:

- title "Posts"

- content_for :info do
    Lots of posts here!

- content_for :main_content do
    -# @posts.each do |post|
    = render :partial => "post_brief", :layout => "post_wrapper", :collection => @posts

    = link_to 'New post', new_post_path

In layouts/application.html.erb (relevant portion only)

<div id="main">
  <%= yield(:main_content) or yield %>
</div>

The result is the following HTML:

<div class='post'>

  <div class='right'>
    <h2><a href="/posts/545688642">Love Potion No. 23 by John Smith</a></h2>
    <p class='post-info'>Lots of posts here!</p>
    The  is such a flawed product!
    This potion, Love Potion No. 7, is defective!
    This potion, Love Potion No. 25, is defective!
    This potion, Love Potion No. 13, is defective!
    This potion, Love Potion No. 17, is defective!
    This potion, Love Potion No. 3, is defective!
    This potion, Love Potion No. 21, is defective!
    This potion, Love Potion No. 4, is defective!
    This potion, Love Potion No. 10, is defective!
    This potion, Love Potion No. 14, is defective!
    This potion, Love Potion No. 22, is defective!
    This potion, Love Potion No. 8, is defective!
    This potion, Love Potion No. 18, is defective!
    This potion, Love Potion No. 1, is defective!
    This potion, Love Potion No. 23, is defective!
  </div>
  <div class='left'>
    <p class='dateinfo'>
      JAN
      <span>31</span>

    </p>
    <div class='post-meta'>
      <h4>Playlist Info</h4>
      <ul>
        <li class='user'>
          <a href='#'>Erwin</a>
        </li>
        <li class='time'>

          <a href='#'>12:30 PM</a>
        </li>
        <li class='comment'>
          <a href='#'>2 Comments</a>
        </li>
        <li class='permalink'>
          <a href='#'>Permalink</a>

        </li>
      </ul>
    </div>
  </div>
</div>
<div class='post'>
  <div class='right'>
    <h2><a href="/posts/545688642">Love Potion No. 23 by John Smith</a></h2>
    <p class='post-info'>Lots of posts here!</p>

    The  is such a flawed product!
    This potion, Love Potion No. 7, is defective!
    This potion, Love Potion No. 25, is defective!
    This potion, Love Potion No. 13, is defective!
    This potion, Love Potion No. 17, is defective!
    This potion, Love Potion No. 3, is defective!
    This potion, Love Potion No. 21, is defective!
    This potion, Love Potion No. 4, is defective!
    This potion, Love Potion No. 10, is defective!
    This potion, Love Potion No. 14, is defective!
    This potion, Love Potion No. 22, is defective!
    This potion, Love Potion No. 8, is defective!
    This potion, Love Potion No. 18, is defective!
    This potion, Love Potion No. 1, is defective!
    This potion, Love Potion No. 23, is defective!
  </div>
  <div class='left'>
    <p class='dateinfo'>
      JAN
      <span>31</span>
    </p>
    <div class='post-meta'>
      <h4>Playlist Info</h4>

      <ul>
        <li class='user'>
          <a href='#'>Erwin</a>
        </li>
        <li class='time'>
          <a href='#'>12:30 PM</a>
        </li>
        <li class='comment'>

          <a href='#'>2 Comments</a>
        </li>
        <li class='permalink'>
          <a href='#'>Permalink</a>
        </li>
      </ul>
    </div>
  </div>
</div>

and so on. (There are 15 items in @post; each one is supposed to have a one-line description, but as you can see, all 15 descriptions get printed for each item.)

I also tried changing index.html.haml to

- content_for :main_content do
    - @posts.each do |post|
        = render :partial => "post_brief", :layout => "post_wrapper", :locals => {:post => post}

but that caused even crazier behavior — the first entry had one description, the second had two, etc.

What’s up?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T03:37:42+00:00Added an answer on May 16, 2026 at 3:37 am

    If you call the content_for helper multiple times in the course of a given render, it will concatenate the content rather than overwriting it, leading to the behavior you see here. I’d recommend turning post_brief + post_wrapper into a single partial and just rendering that rather than using a partial layout.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what on earth am i doing wrong? <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN
I'm running google earth in a web browser that is embedded in a c#
Is Google Earth a Thick Client (Rich Client) application or a Rich Internet Application?
Why on Earth doesn't the interpreter raise SyntaxError everytime I do this: my_abc =
Now that Google Earth has been released for Android 2.1, does anyone know what,
How on earth do I make this work? I have a database with 3
I've been asked to add Google Earth images to a desktop app (civil engineering
How can i create .KMZ (google earth file format) programmatically? .KMZ contains a .KML
I'm creating a Google Earth tour and I'd really like to be able to
The obvious way to plot a path with virtual earth (VEMap.GetDirections) is limited to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.