Salve,
sto impazzendo con le seguenti righe di codice:
@user = User.find(params[:id])
if @user && @user.status == ‘not_verified’ && @user.activation_code ==
params[:code]
@user.status = ‘active’
unless @user.save
flash[:notice] = “Impossibile attivare l’account.”
redirect_to :controller => ‘welcome’
end
else
flash[:notice] = “L’account è già attivo…”
redirect_to :controller => ‘welcome’
end
Continuo ad ottenere “Impossibile attivare l’account”. Cos’è che mi
sfugge in quell’@user.save?
Ecco cosa ottengo nel log degli errori:
Processing AccountController#activate (for 127.0.0.1 at 2008-11-09
19:31:35) [GET]
Session ID:
BAh7CDoMY3NyZl9pZCIlYjFjZDg4NWI2N2YwY2IxODdkMjQ2YTAwMzZiMzc3
OWQ6DHVzZXJfaWRpCiIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxh
c2g6OkZsYXNoSGFzaHsABjoKQHVzZWR7AA==–62b26d3b43dc88e45ccf3c108fe9790c88f5173e
Parameters: {“code”=>“UvJCLYhqdOo89ixzLt6X”, “action”=>“activate”,
“id”=>“4”, “controller”=>“account”}
e[4;35;1mUser Load (0.000227)e[0m e[0mSELECT * FROM “users” WHERE
(“users”.“id” = 4) e[0m
e[4;36;1mSQL (0.000086)e[0m e[0;1mSELECT “email” FROM “users” WHERE
(“users”.email = ‘[email protected]’ AND “users”.id <> 4) e[0m
Redirected to http://localhost:3000/
Completed in 0.00958 (104 reqs/sec) | DB: 0.00031 (3%) | 302 Found
[http://localhost/account/4/activate/UvJCLYhqdOo89ixzLt6X]
Grazie