# Namespaces - 2 times admin in path

**URL:** <https://www.ruby-forum.com/t/namespaces-2-times-admin-in-path/134835>\
**Category:** Rails\
**Created:** [April 15, 2008, 3:06pm UTC](https://www.ruby-forum.com/t/namespaces-2-times-admin-in-path/134835 "2008-04-15T15:06:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marko.hribersek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/dbc845/32.png) [@marko.hribersek](https://www.ruby-forum.com/u/marko.hribersek)\
**Post date:** [April 15, 2008, 3:06pm UTC](https://www.ruby-forum.com/t/namespaces-2-times-admin-in-path/134835/1 "2008-04-15T15:06:58Z")

</div>

Hello folks,

I have a problem with nested namespaces route and can’t figure what to  
do. (I hate this clouse 🙂 )

Let’s say I have (for better understanding)  
posts =\> inv\_ocenas  
comments =\> inv\_ocena\_posts

I am in the form for editing inv\_ocena. At the bottom I have table  
with all correspondig inv\_ocena\_posts.  
When I try to add new inv\_ocena\_posts, the correct url is generated  
(“[http://localhost:3000/admin/inv\_ocenas/2/inv\_ocena\_posts/new](http://localhost:3000/admin/inv_ocenas/2/inv_ocena_posts/new)”), but  
the form for adding new “inv\_ocena\_posts” is not opened. I get error  
“NoMethodError in Admin/inv\_ocena\_posts#new”.

As I can see, the problem is in wrong generated path for add-ing new  
inv\_ocena\_posts “admin\_inv\_ocena\_admin\_inv\_ocena\_posts\_path” ← admin  
is present 2 times in path!!  
It should generate “admin\_inv\_ocena\_inv\_ocena\_posts\_path”

By the book it should work …  
[http://api.rubyonrails.org/classes/ActionController/Routing/RouteSet/Mapper.html](http://api.rubyonrails.org/classes/ActionController/Routing/RouteSet/Mapper.html)  
(It’ll also create admin\_product\_tags\_url pointing to “admin/products/  
#{product\_id}/tags”, which will look for Admin::TagsController.)

I google a lot, but can’t find what I am missing here … please  
help 😉

* * *

## [http://localhost:3000/admin/inv\_ocenas/2/inv\_ocena\_posts/new](http://localhost:3000/admin/inv_ocenas/2/inv_ocena_posts/new)

NoMethodError in Admin/inv\_ocena\_posts#new

Showing admin/inv\_ocena\_posts/\_inv\_ocena\_post.html.erb where line #4  
raised:

undefined method `admin\_inv\_ocena\_admin\_inv\_ocena\_posts\_path’ for  
#ActionView::Base:0x470a2e8

Extracted source (around line #4):

1:  
2:

  
3:  
4: \<% form\_for([@inv\_ocena, @inv\_ocena\_post], :html =\> { :class =\>  
“wufoo topLabel”} ) do |f| %\>  
5:  
6: \<%= error\_messages\_for :inv\_ocena\_post %\>

* * *

map.namespace :admin do |admin|  
admin.resources :inv\_ocenas, :has\_many =\> :inv\_ocena\_posts  
#, :path\_prefix =\> nil

end

* * *
