Forum: Ruby on Rails REST path methods problem

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Dccbabcb75b5820fd12895c8d518ec3e?d=identicon&s=25 coolermaster (Guest)
on 2007-04-29 00:36
(Received via mailing list)
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!
27c170f482104299af279902be0a9c26?d=identicon&s=25 Trevor Squires (Guest)
on 2007-04-29 00:59
(Received via mailing list)

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
new_tranch_path etc.

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.

This topic is locked and can not be replied to.