I am getting this error:
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.[]
from this line:
user = User.any_of({:user_name => login},{:email => login}).first #.and(:encrypted_password => nil).first
I am new to Ruby so I am still trying to get the hang of the syntax. Is there something particularly incorrect or error prone that would cause me to have the object nil[] error?
Also the following line is creating the same error even if I try it without the .downcase
login = (params[:user][:login]).downcase
Thanks!!
in login = (params[:user][:login]).downcase
if you will pass wrong params aka {:not_user => {}} he will try to get get :login value from null hash because there is not :user hash.
So first thing is to check params from your form. I bet it is problem with them, check
You will see what is sent to the controller, or just simply put at top of action
Thats fastest way to find our what is happening with params.
Correct params for you should look like this