This project is archived and is in readonly mode.
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
-
Pascal Ehlert July 2nd, 2008 @ 08:51 AM
Sorry, the above example is slightly incorrect, I have taken out possibility of Hash attributes to retain API consistency, although I liked it.
Depends on you whether we can take it in or not.
-
Repository July 2nd, 2008 @ 01:30 PM
(from [4f75840d72b96fff34d65b59480da7d6c7494120]) Add Inflection rules for String#humanize. [#535 state:resolved] [dcmanges]
Signed-off-by: Pratik Naik
-
Pratik July 2nd, 2008 @ 01:30 PM
- State changed from new to resolved
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>