Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #8262 (closed enhancement: wontfix)

Opened 2 years ago

Last modified 2 years ago

Improvements to content_tag

Reported by: jmckible Assigned to: core
Priority: low Milestone: 1.x
Component: ActionPack Version: edge
Severity: minor Keywords:
Cc:

Description

Now that content_tag works outside of Erb again (circa changeset #6652), it would be nice if it handled blocks a little differently. Example:

content_tag :table do
  content_tag :tr do
     content_tag :td, 'data 1'
     content_tag :td, 'data 2'
  end
end

Doesn't work because only the last td is returned. You'll get

<table>
  <tr>
    <td>data 2</td>
  </tr>
</table>

Instead of

<table>
  <tr>
    <td>data 1</td>
    <td>data 2</td>
  </tr>
</table>

I think if content_tag functioned like this, it would would clean up helpers a lot. I've tried to create a patch, but I can't figure it out. Please let me know if this isn't possible / there's a better solution.

Change History

05/29/07 11:36:03 changed by wincent

Yes, I'd like it to work this way too, although it does look like it might be fairly tricky to implement it. It would involve changing the way that the "capture" method works.

05/29/07 20:42:24 changed by josh

  • status changed from new to closed.
  • resolution set to wontfix.

Closing because there is no proposed patch.