This project is archived and is in readonly mode.

#4407 ✓wontfix
Scott Windsor

PATCH for allowing pluralize to take a block

Reported by Scott Windsor | April 15th, 2010 @ 10:21 PM | in 3.0.2

Here's a patch that allows pluralize to take a block. The use case I run into is something like:

<%= pluralize(122, "chicken") %>

But I want to put specific tags around the count, or around the word.

This patch allows you to ...

<% pluralize(123, "chicken") do |count, word| -%>
  <em><%= count %></em><strong><%= word %></strong>
<% end -%>`

Which results in

<em>123</em><strong>chickens</strong>

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>

Pages