module ActionView::Helpers::TextHelper
def pluralize(count, singular, plural = nil)
pluralize(0, 'person')
# => 3 users
pluralize(3, 'person', 'users')
# => 2 people
pluralize(2, 'person')
# => 1 person
pluralize(1, 'person')
it will use the Inflector to determine the plural form.
+plural+ is supplied, it will use that when count is > 1, otherwise
Attempts to pluralize the +singular+ word unless +count+ is 1. If
def pluralize(count, singular, plural = nil) word = if (count == 1 || count =~ /^1(\.0+)?$/) singular else plural || singular.pluralize end "#{count || 0} #{word}" end