This project is archived and is in readonly mode.

#830 ✓wontfix
Ryan Bates

Add :spacer option to render

Reported by Ryan Bates | August 14th, 2008 @ 05:15 PM | in 2.x

Currently the "render" method allows you to pass a :spacer_template to render a partial between each item in the collection.


<%= render :partial => @items, :spacer_template => 'item_divider' %>

This is good for complex spacers, but sometimes you have a very simple spacer. Like ", " or "<hr />". For these cases, it seems silly to make an external partial which just has this tiny fragment. Even the name of the partial is longer than the contents.

This patch adds a :spacer option which will just take a string.


<%= render :partial => @items, :spacer => "<hr />" %>

You can get that HTML out of the string with the tag method.


<%= render :partial => @items, :spacer => tag(:hr) %>

Much prettier.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Referenced by

Pages