I know this is a minor issue, but why, if you use scaffolding in RoR, can you use lines like 'new_model name here_path' in link tags, but without using scaffolding, I get a NameError? For example, I have a simple address book app that uses basic CRUD operations. I am a RoR beginner but wanted to build an app without scaffolding and these kind of things don't seem to work. I compared my config/routes.rb and app/helpers/* with those in a scaffolded app and they are no different. What am I missing?
Asked
Active
Viewed 2.0k times
2 Answers
16
One way to check your routes and paths is to run:
rake routes
It outputs all your routes and paths.

srboisvert
- 12,679
- 15
- 63
- 87
9
Scaffolding sets up resource routes in the routes.rb file. The resource routes are what give you the path and url helpers. When you don't use scaffolding the routes aren't added, you must do it by hand.
Resource Routes can be added like so:
map.resources :models
where :models is the plural name of one of your models.

Restore the Data Dumps
- 38,967
- 12
- 96
- 122
-
I have that...like I said in the question, my config/routes.rb and all the *_helper.rb files in my app are the same as the ones in a scaffolded app (except for the model names of course) – May 11 '09 at 10:41