変になりActionController::RoutingError: No route matches
ます。ルートを生成できます。
> r = Rails.application.routes
> r.generate controller: :items, action: :index, user_id:1
=> ["/users/1/items", {}]
そしてそれはrake routes
:にあります
$ rake routes
user_items GET /users/:user_id/items(.:format) items#index
POST /users/:user_id/items(.:format) items#create
new_user_item GET /users/:user_id/items/new(.:format) items#new
edit_user_item GET /users/:user_id/items/:id/edit(.:format) items#edit
user_item GET /users/:user_id/items/:id(.:format) items#show
PUT /users/:user_id/items/:id(.:format) items#update
DELETE /users/:user_id/items/:id(.:format) items#destroy
(...)
しかし、私はそれが認識されていません:
r.recognize_path "/users/1/items"
ActionController::RoutingError: No route matches "/users/1/items"
私のroutes.rb
:
Sumo2::Application.routes.draw do
resources :users do
resources :items
end
(...)
end
何か案は?