This project is archived and is in readonly mode.

#535 ✓resolved
Pascal Ehlert

Humanize Inflections

Reported by Pascal Ehlert | July 2nd, 2008 @ 08:49 AM | in 2.x

As discussed and described in the old Rails Trac already, it would be good to be able to specify custom inflection rules and strings for #humanize:

Inflector.inflections do |inflect|
  inflect.human /_cnt$/i, '\1_count'
  inflect.human "legacy_col_person_name", "Name"
  inflect.human "strt_dt" => "Start date",
                "upd_dt"  => "Updated date"
end

"the_cnt".humanize #=> "The count"
"upd_dt".humanize  #=> "Updated date"

I hope this will be accepted this time as it is (at least for me) an important feature and quite easy to implement.

Find attached a patch against edge, including tests.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages