I really need your help guys… I spent 6 hours on this simple update
command today that should work. It works fine in my other controller,
but doesn’t work in this one for some reason.
Here is my controller code for the list view, and then the update
command:
======
def edit
@user = User.find(params[:id])
end
def update
@user = User.find(params[:id])
if @user.update_attributes(@params[:users])
redirect_to(:action => "save_account")
else
flash[:notice] = "Couldn't save account information, please try
again."
redirect_to(:action => ‘edit’, :id => @user.id)
end
end
if I set up a template for update and inspect both @user and
params[:user] this is what I get, in that same order:
======
#“test s address”, “shipping_state”=>“te”, “billing_street”=>“16409”,
“billing_city”=>“test”, “website”=>“www.test.com”,
“shipping_country”=>“test”, “shipping_zip”=>“test”, “id”=>“51”,
“shipping_city”=>“test”, “shipping_option”=>“1”, “billing_state”=>“te”,
“phone”=>“tttttttest”, “billing_country”=>“test”, “billing_zip”=>“test”,
“studio_name”=>“test studio”, “shipping_street”=>“test”,
“password”=>“4f939b7b470595d4c9924342ad57821cc818deac”, “login”=>“test”,
“email”=>“[email protected]”}>
{“shipping_state”=>“te”, “studio_address”=>“test s address”,
“billing_street”=>“testing”, “billing_city”=>“test”,
“website”=>“www.test.com”, “shipping_zip”=>“test”,
“shipping_country”=>“test”, “billing_state”=>“te”,
“shipping_city”=>“test”, “shipping_option”=>“1”, “phone”=>“tttttttest”,
“billing_country”=>“test”, “billing_zip”=>“test”, “studio_name”=>“test
studio”, “shipping_street”=>“test”}
Why is it that my @user starts with a # and never tells it that the
“test s address” is the studio address? Also, why does it end with }>? I
think my @user variable is why my .update_attributes command is failing
and never telling the SQL server to update itself. You will notice that
in my params I don’t include password, login, or email… but that is
because this is just editing user info and I don’t want re-access to
that info. Can someone please help me. Thanks a lot.