+1  A: 

Your @user object is "nil". You need to make sure that you set @user, e.g. via a "before_filter".

DarkDust
In my controller?I have this two:@user = User.new(params[:user])and user = User.find_by_screen_name_and_password(@user.screen_name,@user.password)
noloman
User.new doesn't create a record. You need to use create, or pair new + save. If the record doesn't exist, find_by_XXXX is going to return nil. So, not really sure if you're really running those two back-to-back, but if so, it won't work for you.
nirvdrum
Alright, it has been solved with a simple @user = User.find(session[:user_id]).Nevertheless, now when I press the login button in order to log in a user, I never get redirected to the user profile. I think I'll need to spend a little more time with it, thanks a lot!
noloman