0
請幫我我做一個簡單的登錄,當我測試這個時出現這個錯誤。 請問我如何解決這個錯誤?錯誤簡單登錄「未定義的方法`鍵?'爲零:NilClass「
NoMethodError在UserController的#登錄
未定義的方法`鍵? 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
可能重複[未定義的方法'鍵?'爲零:NilClass](http://stackoverflow.com/questions/9952568/undefined-method-key-for-nilnilclass) – 2012-07-25 22:13:47