0

我有這個在我的routes.rb資源可用輸出父資源軌3.2

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 

我該怎麼辦呢?

謝謝

+0

你重新更改路線後,您的應用程序? – jdoe

+0

是的,我在更改路由後重新啓動了服務器。我正在使用rails 3.2。 – hyperrjas

+0

你需要那個:path =>「/」? – Anil

回答

0

試試這個:

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

有了這個解決方案,我有很長的URL某事像:'HTTP://本地主機:3000/EN /用戶/ kevin29/collections'我希望這個網址'HTTP://本地主機:3000/EN/kevin29/collections'謝謝! – hyperrjas