Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Bad singularization when creating scaffold for "anamnesis"

#6528

I want to create a scaffold for a model named Anamnesis, which is a medical term (see http://en.wikipedia.org/wiki/Anamnesis_(medicine) for more info).

Now, the plural form for anamnesis is anamneses, and Rails handles this correctly. However, in the controller you can see that Rails tries to derive a singular form of the plural form again and it thinks it should be "anamnese", which is wrong. What happens then is that some parts of the controller refer to variables named anamnesis while others refer to variables named anamnese, and this causes the controller to be unable to store data.

Steps needed to reproduce erratic behaviour:

  1. rails new myapp
  2. rails g scaffold anamnesis myfield:string
  3. rake db:migrate
  4. start a server and create an anamnesis
  5. notice that myfield was not stored

Reported by Emil Loer · March 4th, 2011 @ 09:02 PM

State: wontfix
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Andrew White
    Andrew White
    • State changed from new to wontfix
    • Importance changed from to Low

    Edit your inflections.rb initializer to add any custom inflections required by your application, e.g:

    # config/initializers/inflections.rb
    ActiveSupport::Inflector.inflections do |inflect|
      inflect.irregular 'anamnesis', 'anamneses'
    end
    

    March 4th, 2011 @ 09:28 PM