n00b question: 'Having troubles with map.namespace :admin'

Hi everyone!
Im having troubles with my routes.rb, i set map.namespace :admin so i
can enter to my scaffold 'contacts' via admin/contacts', but the view
its crashing showing this error:; *undefined method `contact_path' for
#<ActionView::Base:0xb6743be4>*

The question is: 'where is *contact_path* variable declared?'

The problem is it isn't declared, but somewhere something is trying to
use it.

The scaffold can be nice as a quickstart, but as you're trying to do
something new you're going to have to make changes to the views (and
the controllers too if they use named routes instead of :action
=> :whatever redirects).

A few things to try while tracking it down:

Look at the dev log (or your script/server output) for more
information on the error. It should mention view templates in there
somewhere, and that'll help you find the file & line number to blame.
The stack trace should be in the browser error page as well if you are
in development mode.

Project search for the text contact_path and change it to
admin_contact_path or whatever is appropriate

Look for any forms that are using @contact instead of [:admin,
@contact]
(the symbol tells it about the routing namespace).

HTH

Nick

I'm going to start using Netbeans, I'm using vim right now for my new
experience with ror. That can solve my undeclared variable problem.
So I can say the main problem is trying to call a controller via
'admin/:controller'. I can see that map.resources it's not the
answer... Correct me if I am wrong.
How can I solve it?

Thanks for the reply. It was very useful.

Sebastian wrote:

Hi everyone!
Im having troubles with my routes.rb, i set map.namespace :admin so i
can enter to my scaffold 'contacts' via admin/contacts', but the view
its crashing showing this error:; *undefined method `contact_path' for
#<ActionView::Base:0xb6743be4>*

The question is: 'where is *contact_path* variable declared?'

If you're having a routing issue, the first place to start is to verify
that you have the routes you think you have...

rake routes >routes.lst

then peruse your routes.lst file.

Sounds like you scaffolded your initial views, then changed the
namespace, and broke the generated routing scaffolded into your views.