Sebastian
2010-Jun-20 19:08 UTC
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?'' -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
nruth
2010-Jun-21 16:53 UTC
Re: n00b question: ''Having troubles with map.namespace :admin''
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 On Jun 20, 8:08 pm, Sebastian <sebastian.puch...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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?''-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sebastian
2010-Jun-22 20:31 UTC
Re: n00b question: ''Having troubles with map.namespace :admin''
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. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Ar Chron
2010-Jun-22 20:37 UTC
Re: n00b question: ''Having troubles with map.namespace :admin''
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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.