add options hash to pluralize view helper #3146

stve opened this Issue Sep 27, 2011 · 2 comments


None yet
2 participants

stve commented Sep 27, 2011

Yesterday I wanted to use the pluralize view helper but silence the output of the count so that I could just get the pluralized word. The pluralize method does not currently support this. What I'm proposing is something like this:

pluralize(count, 'vote', 'votes', :exclude_count => true)

This would output 'vote' or 'votes' depending on the count. Any thoughts before I put this in place?

I agree. This would be useful.

Another option would be to wrap the count in a span so it could be controlled separately via CSS:

def pluralize(count, singular, plural = nil)
  "<span>#{count || 0} </span>" + ((count == 1 || count =~ /^1(\.0+)?$/) ? singular : (plural || singular.pluralize))

stve commented Sep 28, 2011

Moving discussion to #3151

@stve stve closed this Sep 28, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment