我的 routes.rb 中有一个如下所示的条目:
resources :baskets, :shallow => true, :only => :show
resource :owned, :only => [:create, :destroy]
end
get '/baskets/owned', :to => 'owners#index'
这会创建如下所示的路线:
basket GET /baskets/:id(.:format)
baskets_owned GET /baskets/owned(.:format)
# ...
但是现在,当我调用 /baskets/owned 时,我得到了这个:
Started GET "/baskets/owned" for 10.0.1.2 at 2011-06-09 10:31:33 -0400
Processing by BasketsController#show as JSON
Parameters: {"id"=>"owned"}
解决此路由冲突的最惯用方法是什么?