This project is archived and is in readonly mode.
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
-
Matt Jones June 8th, 2009 @ 08:56 PM
The inflector isn't particularly aware of non-English pluralization rules; it assumes that the last part of the string is what will change. Thus, you need the two different inflections since /factura_condominio$/ (with the underscore) won't match against 'facturacondominio' (the other version, downcased).
-
Rohit Arondekar October 9th, 2010 @ 04:09 AM
- State changed from new to stale
- Importance changed from to
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>