Custom Camelization
-
30-05-2021 - |
Question
Is there any way to specify exceptions for camelize
?
For example, if I wanted camelize('uses_sql')
to be usesSQL
instead of the what camelize
produces by default, usesSql
. This doesn't seem to be covered by the standard inflections exception config.
Solution
Turns out to be supported in Rails 3.2 with acronym.
For Rail 3.1, I created a custom version by copying some of the relevant methods in the source to override default behavior.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow