开发者

Rails : Scaffold works for the first, but not for the second table

I am using aptana radrails empty rail project : scaffold Article titre:string body:text categorie_id:integer ordre:integer Migrate -> it works fine

scaffold Categorie titre:string ordre:integer

It generate the files but when i access http://127.0.0.1:3000/categories i have the following error :

NameError in Categories#index Showing app/views/categories/index.html.erb where line #22 raised:

undefined local variable or method `new_categorie_path' for #

Extracted source (around line #22):

19: 20:

21: 22: <%= link_to 'New categorie', new_categorie_path %>

i deleted recreat开发者_高级运维ed my whole rails project a few times, changed categorie with another name but it keep failling. Why ?


Adding to Salil's answer which is correct, Rails convention is to have english like naming.

If you put

Categorie

in your scaffold Rails will not be able to pluralize it correctly in categories.

You can also try a different path using legacy names and no pluralization but it is a painful path.

I would advice to use english naming.


It should be

scaffold Category titre:string ordre:integer
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜