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          
r...@agileconsultingllc.com     http://AgileConsultingLLC.com/
r...@gaslightsoftware.com               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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to