4

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?

1 Answers1

10

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.

Yves Senn
  • 2,006
  • 16
  • 13