Namespaces - 2 times admin in path

Hello folks,

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

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”), 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
(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 :wink:


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


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs