On Oct 27, 2010, at 8:35 AM, Vitaliy Yanchuk wrote:

How can I use proper word after number, depending on that number.
For example I have message that says:

for 23 monthes, or it can be 21 month.
So I have to inflect depending on number

--


If you're in a Rails view, you can say:

  pluralize(n, 'month')

If you're just in plain Ruby, it might depend on the pluralization rule:

  "#{n} month#{'s' unless n == 1}"

  "#{n} part#{n == 1 ? 'y' : 'ies'}"

  "#{n} fish"

-Rob

Rob Biedenharn          
[email protected]     http://AgileConsultingLLC.com/
[email protected]               http://GaslightSoftware.com/

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to