Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

PATCH for allowing pluralize to take a block

#4407

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>

Reported by Scott Windsor · April 15th, 2010 @ 10:21 PM

State: wontfix
Milestone: 3.0.2
Assigned to: Yehuda Katz (wycats) Yehuda Katz (wycats)
Importance: Low

Activity

  1. Scott Windsor
    Scott Windsor
    • Tag changed from 2.3, actionpack, pluralize to 2.3, actionpack, patch, pluralize

    April 15th, 2010 @ 10:21 PM

  2. GB Bowers
  3. Rizwan Reza
    Rizwan Reza
    • Milestone cleared.
    • State changed from new to verified
    • Assigned user set to Yehuda Katz (wycats)

    +1 verified

    The tests failed with the patch so, I have changed the code slightly and added tests. Applied again to verify. The patch is attached.

    May 15th, 2010 @ 09:47 AM

  4. Rizwan Reza
    Rizwan Reza
    • State changed from verified to wontfix

    May 15th, 2010 @ 03:25 PM

  5. Scott Windsor
    Scott Windsor

    The patch works for me as well. Why did you change this to wontfix?

    May 15th, 2010 @ 07:23 PM

  6. Jeremy Kemper
    Jeremy Kemper
    • Milestone set to 3.0.2
    • Importance changed from to Low

    October 15th, 2010 @ 11:01 PM