When I run:
script/generate scaffold_resource Tranche
I get the following error:
Showing app/views/tranches/index.rhtml where line #24 raised:
undefined local variable or method `new_tranches_path’ for #<#<Class:
I have a number of other resources that seem to work fine when
generated the same way–it’s just Tranche that’s creating problems. Is
this some kind of reserved word? Or is there a pluralization issue?
Any help would be appreciated!
First of all, when you use new_xxx_path() you should use the singular-
form of xxx, which should be tranche in this case.
However, in the console it’s pretty easy to see that there is a
problem with the singularization of ‘tranches’:
“tranche”.pluralize.singularize #=> “tranch”
Which means that map.resources :tranches will force you to use
You can fix this in your map.resources call:
map.resources :tranches, :singular => ‘tranche’
Then you can do: new_tranche_path, edit_tranche_path, tranches_path.