This project is archived and is in readonly mode.

#2783 ✓stale
Gustavo Delfino

Inflections issue with script/generate scaffold

Reported by Gustavo Delfino | June 8th, 2009 @ 06:17 PM | in 3.x

I need to add two infections for a single term in order to have Rails behave correctly:

1) inflect.irregular 'factura_condominio', 'facturas_condominio'
2) inflect.irregular 'FacturaCondominio', 'FacturasCondominio'

If I only use (1) then I get:

create  app/controllers/factura_condominios_controller.rb
create  test/functional/factura_condominios_controller_test.rb
create  app/helpers/factura_condominios_helper.rb
create  test/unit/helpers/factura_condominios_helper_test.rb
 route  map.resources :factura_condominios

If I only use (2) then I get

create    test/fixtures/factura_condominios.yml
create    db/migrate/20090608162459_create_factura_condominios.rb

Not only the migration filename is incorrect, but the whole migration is invalid as the migration filename doesn't match its class name (CreateFacturasCondominio). Therefore it fails with this error: "uninitialized constant CreateFacturaCondominios"

Even if I manually fix all the problems the migration, and use set_table_name in the model, I get into trouble further down the road when I try to use the REST helpers. For example, the call to new_factura_condominio_path (written by the scaffolding code) is not recognized.

There is one more thing. script/destroy also fails to remove all the files created by script/generate scaffold.

To work around all this problems, I just have to use both inflections. But having to use both is clearly not the desired behavior.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>