views:

23

answers:

1

I want to have an admin area. So I wrote:

map.namespace "admin" do |admin|
  admin.resources :cities 
  admin.resources :links
end

But I would like to the admin area for a specific location. I am looking for something like:

map.namespace "admin/:location_id" do |admin|
  admin.resources :cities 
  admin.resources :links
end

what would be the correct way to do this?

A: 
map.with_options(:path_prefix => "admin/:id", :name_prefix => "admin_") do |admin|
  admin.resources :cities 
  admin.resources :links
end

You can remove :name_prefix if you want

Bohdan Pohorilets