我收到此错误:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
从这一行:
user = User.any_of({:user_name => login},{:email => login}).first #.and(:encrypted_password => nil).first
我是 Ruby 新手,所以我仍在尝试掌握语法。是否有一些特别不正确或容易出错的东西会导致我出现对象 nil[] 错误?
即使我在没有 .downcase 的情况下尝试,以下行也会产生相同的错误
login = (params[:user][:login]).downcase
谢谢!!