Ruby on Rails: Override singularize, pluralize.

By kenglish

It took me a while to figure this out but it’s really a no brainer.
I was getting:

>> "biodatabases".singularize
=> "biodatabasis"

To fix this, I edited config/initializers/inflections.rb and added:

ActiveSupport::Inflector.inflections do |inflect|
   inflect.irregular 'biodatabase', 'biodatabases'
end

I know this is in the docs somewhere but I put in on my blog so I don’t forget.



categoriaUncategorized commentoNo Comments dataMarch 27th, 2009

About... kenglish

This author published 76 posts in this site.

Share

FacebookTwitterEmailWindows LiveTechnoratiDeliciousDiggStumbleponMyspaceLikedin

Leave a comment