Making a rails inflection for possessive strings?
Posted
by chovy
on Stack Overflow
See other posts from Stack Overflow
or by chovy
Published on 2009-07-12T04:01:39Z
Indexed on
2010/03/31
0:43 UTC
Read the original article
Hit count: 596
ruby-on-rails
I would like to create a method in additional to the default 'foo'.titlecase that will correctly add "possessiveness" to it.
The string is a user's name (<- just did one right there! )
For example: "sam" is the user <%= user.titlecase.possessive + ' Profile' %> => #Sam's Profile
It just needs to handle edge cases like:
Steelers's Profile ( should be Steelers' Profile) Ross's Profile ( should be Ross' Profile )
© Stack Overflow or respective owner