开发者

Rails 2.3.5: How do I add an :id field to a namespace?

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

map.namespace "admin" do |admin|
  admin.resources :cities 
  admin.resources :lin开发者_如何学Cks
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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜