Created
July 13, 2010 19:37
-
-
Save amiel/474384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def possessivize(owner) | |
owner.ends_with?('s') ? owner + "’" : owner + "’s" | |
end |
Alternative for those wanting to use a plain ascii '
:
def possessivize(owner)
"#{owner}'#{'s' unless owner.ends_with?('s')}"
end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like a nice minimal solution to http://stackoverflow.com/questions/1115283/making-a-rails-inflection-for-possessive-strings