试图创建一个button_to
更新单个属性的,但我收到路由错误。这是代码:
<%= button_to 'update', :action => 'update', :controller => 'users', :form => {:user => current_user, :share_articles_on_facebook => true} %>
和错误:
No route matches {:action=>"update", :controller=>"users", :form=>{:user=>#<User id: 3, ema....
添加显式:method
并不能解决问题。以下是路线:
users GET /users(.:format) {:action=>"index", :controller=>"users"}
POST /users(.:format) {:action=>"create", :controller=>"users"}
new_user GET /users/new(.:format) {:action=>"new", :controller=>"users"}
edit_user GET /users/:id/edit(.:format) {:action=>"edit", :controller=>"users"}
user GET /users/:id(.:format) {:action=>"show", :controller=>"users"}
PUT /users/:id(.:format) {:action=>"update", :controller=>"users"}