我的用户索引视图中的这一行:
<%= simple_form_for current_user, :url => user_change_client_path,
:method => :patch,
:id => current_user.id do |f| %>
生成以下错误:
No route matches {:action=>"change_client", :controller=>"users"} missing required keys: [:user_id]
我在我的控制器中定义了 change_client 操作。在我的 routes.rb 我有:
resources :users, only: [:index] do
patch 'change_client'
patch 'approve'
end
耙路线显示:
user_change_client PATCH /users/:user_id/change_client(.:format) users#change_client
user_approve PATCH /users/:user_id/approve(.:format) users#approve
我做错了什么导致错误?