ActiveSupport Inflections - humanize vs titleize
ActiveSupport has a lot of useful inflections to transform strings, and I often forget which one does what exactly.
#humanize
will capitalize the first word, whereas #titleize
will capitalize every word:
"hi_how_are_you?".humanize
# => "Hi how are you?"
"hi_how_are_you?".titleize
# => "Hi How Are You?"
Actually, it turns out #titleize
is just a special case of #humanize
!