In a Rails app I have Users who can have notes created under them in each user show view.
From the show view notes can be added and edited. The edit link routes properly to the edit path for each note. Clicking save to update the note redirects back to the user show view.
Here is my notes controller:
def update
@note = Note.find(params[:id])
redirect_to user_path(@note.user)
end
However, I am trying to update a note entry and in the console I am seeing that it is not updating for some reason. There should be UPDATE step between BEGIN and COMMIT, but it seems to be missing here.
Started PUT "/notes/2" for 127.0.0.1 at 2013-02-01 01:50:25 -0800
Processing by NotesController#update as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"Wr+urG+6QvsbPuFpVGUEEqc8QVYiu5q8j389YmOi6Zg=", "note"=>{"author"=>"MZ", "note"=>"Test"}, "id"=>"2"}
Note Load (0.2ms) SELECT "notes".* FROM "notes" WHERE "notes"."id" = $1 LIMIT 1 [["id", "2"]]
(0.2ms) BEGIN
(0.1ms) COMMIT
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
Redirected to http://localhost:3000/users/1
Completed 302 Found in 37ms (ActiveRecord: 3.8ms)
What is the reason for why there is no UPDATE step?
You are not updating the attributes. You must call
update_attributesand pass theparamsto be updated.