Why does titleize remove hyphens?


#1

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


#2

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/


#3

Bleh, bug IMO. I can understand converting underscores to spaces, but
not hyphens. Plus, titleize screws up apostrophes:

JOE’S -> Joe’S

Joe


#4

Submitted (for the apostrophes part, anyway):

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

Cheers,
David


#5

Thanks!

Joe