This project is archived and is in readonly mode.
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
-
Scott Windsor April 15th, 2010 @ 10:21 PM
- Tag changed from 2.3, actionpack, pluralize to 2.3, actionpack, patch, pluralize
-
Rizwan Reza May 15th, 2010 @ 09:47 AM
- 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.
-
Rizwan Reza May 15th, 2010 @ 03:25 PM
- State changed from verified to wontfix
-
Scott Windsor May 15th, 2010 @ 07:23 PM
The patch works for me as well. Why did you change this to wontfix?
-
Jeremy Kemper October 15th, 2010 @ 11:01 PM
- Milestone set to 3.0.2
- Importance changed from to Low
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>