[ruby-it] Problema con @user.save

Marco Colli collimarco91 a gmail.com
Dom 9 Nov 2008 19:39:49 CET


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"}
  User Load (0.000227)   SELECT * FROM "users" WHERE
("users"."id" = 4) 
  SQL (0.000086)   SELECT "email" FROM "users" WHERE
("users".email = 'collimarco91 a gmail.com' AND "users".id <> 4) 
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
-- 
Posted via http://www.ruby-forum.com/.


More information about the Ml mailing list