Rails 给出以下错误:
No route matches [POST] "/users/32"
即使路由、视图和控制器设置正确。我错过了什么?
环境:Rails 3.2.12,Ruby 2.0.0p0
路线
Foo::Application.routes.draw do
resources :users
match '/pages/:action', controller: "pages", as: "pages"
root to: 'pages', action: 'index'
end
耙路线
users GET /users(.:format) users#index
POST /users(.:format) users#create
new_user GET /users/new(.:format) users#new
edit_user GET /users/:id/edit(.:format) users#edit
user GET /users/:id(.:format) users#show
PUT /users/:id(.:format) users#update
DELETE /users/:id(.:format) users#destroy
pages /pages/:action(.:format) pages#:action
root / pages#index
哈姆
= form_tag "/#{@collection_name}/#{@entity.id}", :method => :put do
...
哪个被转换成这个html
<form accept-charset="UTF-8" action="/users/32" method="post">
<div style="margin:0;padding:0;display:inline">
<input name="utf8" type="hidden" value="✓">
<input name="_method" type="hidden" value="put">
<input name="authenticity_token" type="hidden" value="NnD8tNkx//5o3TQWhBYxFgYGS8kG9n+7WSeA0mon9t8=">
</div>
...