Error Simple Login "undefined method `key?' for nil:NilClass"
===

Please help-me i wen make a simple login and this error appear when i test this.
Please how i solve this error?


NoMethodError in UserController#login

undefined method `key?' for nil:NilClass

      def login
        if request.post?
          if session[:user] = User.authenticate(params[:user][:login],params[:user][:password])
            flash[:message] = 'Voce esta Logado !'
            redirect_to_stored
          else
            flash[:warning] = 'Usuario e/ou Senha incorreta !'
          end
        end
      end


