Forum: Ruby on Rails Why does titleize remove hyphens?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Joe (Guest)
on 2006-04-06 03:56
item.title = 'alpha-bravo'
item.title = item.title.titleize
puts item.title

alpha bravo

I didn't notice this with 1.0 - a new bug in 1.1?

Joe
Rimantas L. (Guest)
on 2006-04-06 14:02
(Received via mailing list)
> item.title = 'alpha-bravo'
> item.title = item.title.titleize
> puts item.title
>
> alpha bravo
>
> I didn't notice this with 1.0 - a new bug in 1.1?

I'd say feature, not bug. Inflector.titleize calls function underscore,
which
translates - to _ and then calls function humanize which converts
underscores to
spaces...

Regards,
Rimantas
--
http://rimantas.com/
Joe (Guest)
on 2006-04-06 23:26
Bleh, bug IMO. I can understand converting underscores to spaces, but
not hyphens. Plus, titleize screws up apostrophes:

JOE'S -> Joe'S

Joe
David R. (Guest)
on 2006-04-06 23:28
(Received via mailing list)
Submitted (for the apostrophes part, anyway):

http://dev.rubyonrails.org/ticket/4607

Cheers,
David
Joe (Guest)
on 2006-04-06 23:51
Thanks!

Joe
This topic is locked and can not be replied to.