Reputation: 1394
def plural(value, string) "#{value} #{value.abs == 1 ? string.singularize : string.pluralize}" end
If not, what would be a short, sweet name for this method?
Upvotes: 14
Views: 4291
Reputation: 6052
ActionView::Helpers::TextHelper
pluralize(1, 'person') # => 1 person pluralize(2, 'person') # => 2 people
More documentation and examples available here
Upvotes: 22