Problem updating a database field from my controller
Posted
by ben
on Stack Overflow
See other posts from Stack Overflow
or by ben
Published on 2010-05-24T04:17:32Z
Indexed on
2010/05/24
4:20 UTC
Read the original article
Hit count: 384
ruby-on-rails
|mvc
I have an update method in my users controller that I call from a HTTPService in Flex 4. The update method is as follows:
def updateName
@user = User.find_by_email(params[:email])
@user.name = params[:nameNew]
render :nothing => true
end
This is console output:
Processing UsersController#updateName (for 127.0.0.1 at 2010-05-24 14:12:49) [POST]
Parameters: {"action"=>"updateName", "nameNew"=>"ben", "controller"=>"users", "email"=>"[email protected]"}
User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."email" = '[email protected]') LIMIT 1 Completed in 20ms (View: 1, DB: 1) | 200 OK [http://localhost/users/updateName]
But when I check my database, the name field is never updated. What am I doing wrong? Thanks for reading.
© Stack Overflow or respective owner