Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7820701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:23:52+00:00 2026-06-02T07:23:52+00:00

I am getting this error: You have a nil object when you didn’t expect

  • 0

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!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T07:23:54+00:00Added an answer on June 2, 2026 at 7:23 am

    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

    log/development.log 
    

    You will see what is sent to the controller, or just simply put at top of action

    raise params.inspect
    

    Thats fastest way to find our what is happening with params.

    Correct params for you should look like this

    {:user => {:login => "user login ble ble", :password => "ple ple"}}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting this error: [code] You have a nil object when you didn't
I'm getting this error with the Paperclip gem. NoMethodError (You have a nil object
I keep getting this error and I have tried putting quotes around the actual
we've been getting this error lately and have no idea why, we are not
I keep getting this error all over the place where I only have jquery
I keep getting this error and I really dont know why. I have tried
I am getting this error on a website I'm working on, I have simplified
In my application I am getting this error: You can only have one <head
I have zero idea as to why I'm getting this error.
I have created a custom function and I am getting this error. I dont

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.