Stripping "_id" in titleize

45 views
Skip to first unread message

Carol Dawson

unread,
Mar 19, 2015, 11:38:32 AM3/19/15
to rubyonra...@googlegroups.com
I was just wondering what other people think about "_id" being stripped out when using titleize. I have been trying to generate a title "Genetic Id" from a "genetic_id" string and have found that the titleize method actually produced the title string "Genetic".

"genetic_id".titleize  produces
"Genetic"

I was expecting
"Genetic Id"

This is a rather unexpected result for me and I was wonder whether others think this is reasonable behaviour.

I see that this is caused because titleize uses humanize, which strips it out.

Trivial I know, I was just surprised.
Thanks
Carol

Jason King

unread,
Mar 20, 2015, 10:39:55 AM3/20/15
to rubyonra...@googlegroups.com
Definitely desirable behavior in the 99% use case, maybe there's room for a `strip: false` optional arg or something.

Nicholas Firth-McCoy

unread,
Mar 21, 2015, 6:57:22 PM3/21/15
to rubyonra...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages