Backport inflection fix to Rails 3.2

I just want to backport these commits to 3.2 since we need them in our live project.