pluralize(integer, string)

pluralize takes an integer argument and then returns the number with a properly pluralized version of its second argument. It isn’t available in the console by default, but we can include it explicitly through the ActionView::Helpers::TextHelper module.

>> ActionView::Helper::TextHelper
>> pluralize(2, “woman”)
=> “2 women”
>> pluralize(3, “erratum”)
=> “3 errata”

Advertisements