Trying to create a button_to that updates a single attribute, but I’m getting routing errors. Here’s the code:
<%= button_to 'update', :action => 'update', :controller => 'users', :form => {:user => current_user, :share_articles_on_facebook => true} %>
And the error:
No route matches {:action=>"update", :controller=>"users", :form=>{:user=>#<User id: 3, ema....
Adding an explicit :method didn’t fix the problem. Here are the routes:
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"}
So, simple mistake. It wanted an
:idelement, obviously.