Reputation: 41
I use Ruby 1.9.3 and Rails 3.2.9, when I do the following in a rails console:
1.9.3p125 :003 > "foot".pluralize => "foots" # shouldn't it be "feet"?
1.9.3p125 :004 > "tooth".pluralize => "tooths" # shouldn't it be "teeth"?
1.9.3p125 :009 > "goose".pluralize => "gooses" # shouldn't it be "geese"?
is that a bug in rails pluralize or I did something wrong?
Upvotes: 4
Views: 1167
Reputation: 1996
You can configure the rails inflector. There should be an initializer file in your application to do so: config/initializers/inflections.rb
You can then add a call to "teach" rails the new rule:
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'tooth', 'teeth'
end
After you restart the server/console the new pluralization should be in place.
Upvotes: 10