I just happened to encounter a problem with the ActiveSupport inflector in my Rails app. Here’s the problem: words that end in ess seem to be an issue. For example:
Turns out that “Rails has a longstanding policy of not taking further inflector patches. Use an initializer in your application instead,” a quote from Mike Gunderloy. What exactly does this mean? Simple…
Within your Rails application, open the config/initializers/inflections.rb file and just add the following:
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular(/ess$/i, 'ess')
end
This entry was posted in Ruby on Rails and tagged Rails, Ruby. Bookmark the permalink. Both comments and trackbacks are currently closed.
Damien White is a developer in Connecticut that simply loves coding. Ever since he was young, he has had a driving passion for computers and software development, and a thirst for knowledge that just cannot be quenched. He’s happy to share what he knows in his quest to learn as much as possible.
ActiveSupport Singularize Problem
I just happened to encounter a problem with the ActiveSupport inflector in my Rails app. Here’s the problem: words that end in ess seem to be an issue. For example:
D’oh, where did that ending ‘s’ go?
Turns out that “Rails has a longstanding policy of not taking further inflector patches. Use an initializer in your application instead,” a quote from Mike Gunderloy. What exactly does this mean? Simple…
Within your Rails application, open the config/initializers/inflections.rb file and just add the following:
ActiveSupport::Inflector.inflections do |inflect| inflect.singular(/ess$/i, 'ess') endAll better…
Damien White is a developer in Connecticut that simply loves coding. Ever since he was young, he has had a driving passion for computers and software development, and a thirst for knowledge that just cannot be quenched. He’s happy to share what he knows in his quest to learn as much as possible.