0

我的 routes.rb 中有这个

resources :users, :path => "/", :only => [:show] do
  resources :collections, :controller => 'users/collections'
end

为什么我可以从以下位置访问收藏资源:

http://localhost:3000/en/collections

如果这会在内部用户中获取此资源?

我只想collection resource在里面启用:

http://localhost:3000/en/users/collections

这是我的路线:

user_collections GET    (/:locale)/:user_id/collections(.:format)          users/collections#index
                         POST   (/:locale)/:user_id/collections(.:format)          users/collections#create
     new_user_collection GET    (/:locale)/:user_id/collections/new(.:format)      users/collections#new
    edit_user_collection GET    (/:locale)/:user_id/collections/:id/edit(.:format) users/collections#edit
         user_collection GET    (/:locale)/:user_id/collections/:id(.:format)      users/collections#show
                         PUT    (/:locale)/:user_id/collections/:id(.:format)      users/collections#update
                         DELETE (/:locale)/:user_id/collections/:id(.:format)      users/collections#destroy

我该怎么做?

谢谢

4

1 回答 1

0

尝试这个:

resources :users, :only => [:show] do
  resources :collections, :controller => 'users/collections'
end
于 2012-06-04T17:37:18.227 回答