This project is archived and is in readonly mode.
active_support/core_ext/string/inflections doesn't load default inflections
Reported by Guillaume Laville | February 22nd, 2011 @ 09:26 AM | in 3.x
Requiring 'active_support/core_ext/string/inflections'
doesn't load default inflections (active_support/inflections) in AS
3.0.4 :
When using AS as a standalone library (such as in mail gem,
https://github.com/mikel/mail)
this may result in broken String#singularize/String#pluralize
methods which can go unnotticed
(the mentionned gem only actually use String#constantize).
Others libraries, such as Sequel, try to use these methods if
they are defined instead
of their own implementation, which produces nasty bugs later in the
program without any
actual action from the user other than requiring both the mail and
sequel libraries.
Is directly loading 'active_support/core_ext/string/inflections'
(or indirectly,
via 'active_support/core_ext/string') without defining its own
inflections considered bad form,
in which case I may report the problem to the mail author, or
should the default
inflections be always loaded ?
(The test suite case for core_ext/string doesn't appear to be affected thanks to an implicit active_support/inflections loading done by one of the explicit requires).
Comments and changes to this ticket
-
Dan Pickett March 12th, 2011 @ 04:39 PM
+1 there should be a consistent and documented mechanism to load default inflections.
I would think that require "active_support/inflector" would be the desired require statement.
That appears to properly load the inflections along with the core string extensions.
-
Dan Pickett March 12th, 2011 @ 05:25 PM
- State changed from new to open
- Milestone set to 3.x
- Assigned user set to Dan Pickett
- Importance changed from to Low
If no one objects, I don't think this is a bug, and I'd like to close this out.
I think the require statement in my comment above is what gem authors should be using.
-
Andrew White March 12th, 2011 @ 09:33 PM
Agreed - 'active_support/inflector' is the correct require.
-
Dan Pickett March 12th, 2011 @ 10:36 PM
- State changed from open to invalid
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>