I know you can pluralize a word in Rails using the pluralize feature.
pluralize (3, 'cat')
=> 3 cats
But what I'm trying to do is pluralize a sentence that needs to pluralize multiple words.
There are <%= Cat.count %> cats
The problem with this, is if there is only 1 cat. It would return
There are 1 cats
Which doesn't make sense gramatically.
It should say
There are x cats (if x is not 1)
There is 1 cat (if there is only 1)
Problem is, I can't figure out how to pluralize this, since we have two arguments here (is and cat).
Any help will be appreciated.
Maybe something like this?
if Cat.count == 1
puts "There is 1 cat"
else
puts "There are #{Cat.count} cats"
end