Using the rails button_to
helper I'm trying to run the update
method in a controller. I need to set the ID of the object being updated manually. The code I have I think should be right, but rails keeps trying to put the ID as part of a route.
in the view:
button_to ">", :controller=>'people', :action=>'update', 'person'=>{:team=>team_leader.team}, :id=>currently_viewing_person
in the controller:
def update
@person = Person.find(params[:id])
#...rest of method
end
The controller update method is never executed. The error on the web browser is:
Unknown action
No action responded to 3. Actions: create, index, new, search, show, and update
'3' was the value of currently_viewing_person
What's the correct way to pass :id
so update can extract from params[:id]