I looked in the Rails docs under inflector and found this message...
Module deprecated
This module is deprecated on the latest stable version of Rails. The last existing version (v2.1.0) is shown here.
There was no explanation or reference to any further detail.
I recalled seeing a Rails Trac website. I hunted that down and found that it too is deprecated. It referred me to Lighthouse.
I found some info there -- the Rails core team is not accepting patches for inflections.rb
. But it didn't really explain the deprecation message. What is the story behind that?
You might take a look at this post for an explanation.
I'm looking at the Edge Rails source code for inflector.rb
right now and I can't see anything to say that it's deprecated—where did you get that information from?
Patches aren't being accepted because they might break legacy code that's relying on incorrect inflections. You can add your own rules by accessing the singleton instance yielded by Inflector.inflections
, as shown below:
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'person', 'people'
inflect.uncountable 'rails'
end
Two separate issues at play. Inflections won't be patched to correct errors to protect legacy uses of incorrect inflections but more importantly inflections was moved into ActiveSupport as of 2.2.1
see 2.2.1 here versus pre 2.2.1 here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With