Forum: Ruby on Rails Problem with nested shallow in admin namespace

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C5283f5f6e2659a1b4e7ddb87eca0640?d=identicon&s=25 Pietia (Guest)
on 2009-03-06 15:28
(Received via mailing list)
Hi all.

I have admin namespace with project resource connected to it ( as
written in code below ). I need only to access blocks/sections/menus
( which are all connected to projects in admin namespace ) via project
( for example admin/projects/1/menu/1 ).

I thought about shallow => true to make my life easier. and wrote
something like this :

  map.namespace :admin do |admin|
     admin.resources :projects, :shallow => true, :has_many =>
[:blocks, :sections, :menus] , :has_one => [ :language, :skin ]
  end

( i assume there is something wrong )

Desire is that i will have access to /admin/projects/1/menus/1 via /
admin/menus/1.

how can i define it correctly ( i mean routes code ) ?

Right now i got error :

Showing app/views/admin/projects/index.html.erb where line #24 raised:
undefined method `admin_project_path' for #<ActionView::Base:
0x26a55d4>

I assume if i define shallow => true that i have still possibility to
write admin_project_menu path to get what i want ( if im wrong and
there is only menus_path helper please tell me )

One more thing is that : normally with /admin/projects/2/menus i can
just write  @project = params[:project_id] in menu_controller
index_method  and i will happily have access in menu_index_view to
project ( which is parent of that menus in index ). How can i do it
with shallow option if i have only admin/menus/ ??

Thank you for help !
This topic is locked and can not be replied to.