我有下一个资源
resources :countries do resources :cities end resources :cities do resources :streets end@H_403_3@它会产生下一条路线
GET /countries/:country_id/cities(.:format) cities#index POST /countries/:country_id/cities(.:format) cities#create new_country_city GET /countries/:country_id/cities/new(.:format) cities#new edit_country_city GET /countries/:country_id/cities/:id/edit(.:format) cities#edit GET /countries/:country_id/cities/:id(.:format) cities#show PUT /countries/:country_id/cities/:id(.:format) cities#update DELETE /countries/:country_id/cities/:id(.:format) cities#destroy ...... cities GET /cities(.:format) cities#index POST /cities(.:format) cities#create new_city GET /cities/new(.:format) cities#new edit_city GET /cities/:id/edit(.:format) cities#edit city GET /cities/:id(.:format) cities#show PUT /cities/:id(.:format) cities#update DELETE /cities/:id(.:format) cities#destroy@H_403_3@我不希望访问城市可以没有国家ID但我也不想使用3级嵌套资源,所以我可以改变下一个路线
resources :countries do resources :cities end resources :cities,:except => [:index,:destroy,:edit,:show,:create,:new,:update] do resources :streets end@H_403_3@是否有某种快捷方式可以禁用所有操作,而不是写入所有默认操作:除了选项????
解决方法
resources :cities,:only => [] do ... end@H_403_3@