Synopsis : The basic ideea is this, user logs into his account,
acceses a link and wants to edit his info, let’s say first name,
email, last name. The user session is stored obviously in a session.
Problem is, I cannot update the information. Here’s the code:
def update_admin_account_options
@admin = Admin.find(params[:id])
if request.post?
if @admin.update_attributes(params[:admin])
flash[:notice] = ‘Account information was successfully
updated.’
redirect_to :action => ‘edit_account_options’, :id => @admin
else
flash[:notice] = “Account information cannot be updated!”
render :action => ‘edit_account_options’
end
end
end
and the development.log
Processing AdminController#update_admin_account_options (for 127.0.0.1
at 2007-10-15 23:04:42) [POST]
Session ID: fa51971fbde3e17078b4185894263ad0
Parameters: {“commit”=>“Update”, “admin”=>{“firstname”=>“test”,
“lastname”=>“Angel”, “email”=>“[email protected]”},
“action”=>“update_admin_account_options”, “id”=>“16”,
“controller”=>“admin”}
[4;35;1mAdmin Columns (0.000000) [0m [0mSHOW FIELDS FROM
admins [0m
[4;36;1mAdmin Load (0.016000) [0m [0;1mSELECT * FROM admins
WHERE (admins.id
= 16) [0m
[4;35;1mSQL (0.000000) [0m [0mBEGIN [0m
[4;36;1mAdmin Load (0.000000) [0m [0;1mSELECT * FROM admins
WHERE (admins.username = ‘admin’ AND admins.id <> 16) LIMIT 1 [0m
[4;35;1mSQL (0.000000) [0m [0mCOMMIT [0m
Rendering layoutfalseactionedit_account_options within layouts/admin
Rendering admin/edit_account_options
Completed in 0.29700 (3 reqs/sec) | Rendering: 0.03100 (10%) | DB:
0.01600 (5%) | 200 OK [http://127.0.0.1/admin/
update_admin_account_options/16]
I checked the @params with the debug, everything looks ok. Any idea?