creating new record instead of update

I have a simple app to track goals. I'm having an issue with a simple update.

scaffold update works great to edit the entire goal, however I have a simple update on the index page to only update 1 item on the tracker, the current value of the tracked goal.

I cannot find a solution for the problem. My simple form\_with to select the existing goal

<%= :name, options_for_select(@goals.collect { | goal | [] } )%>

and update the current goal

<%= onpageupdate.label "New Attempt" %>
<%= onpageupdate.text_field :curvalue, type: "number" %>
<%= onpageupdate.submit %>

This only creates a new record. the controller for this function reads

def onpageupdate
@goal = Goal.find(params[:id])

wat am i missing?

Leave a Comment