This project is archived and is in readonly mode.
Inflector.underscore() is not consistent with camelize()
-
Pratik
- State changed from new to incomplete
Can we please have a patch with failing tests ? http://guides.rails.info/contrib... should be helpful.
Thanks !
-
Nick Eskelinen
- Tag set to activeresource, bug, inflector
Hmm, so I tried to write a failing test, but it appears this behavior is explicitly tested for (with incorrect behavior, IMO) in inflector_test_cases.rb:
CamelToUnderscoreWithoutReverse = { "HTMLTidy" => "html_tidy", "HTMLTidyGenerator" => "html_tidy_generator", "FreeBSD" => "free_bsd", "HTML" => "html", }So it looks like there are 2 options: 1) Fix documentation to not claim that camelize() and underscore() are inverse functions (and warn that string.underscore.camelize != string) 2) Fix underscore() to break on (all) caps boundaries and provide a facility for making exceptions (probably via the Inflector#inflections method)
My personal feeling is that #1 Migrations will not run on a fresh database is ignoring the fundamental problem with the current behavior of underscore() -- there is no way to go from an underscored transformation back to the original camelized form.
Comments?
-
rails
- State changed from incomplete to open
- Importance changed from to
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
rails
- State changed from open to stale