Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

undefined method `key?' for nil:NilClass error

I am doing the Ruby training and got this error. I can't work out how to fix it.

NoMethodError in StatusesController#index undefined method `key?' for nil:NilClass

5 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hi Chris, where did you get that error?

Hi Chris! Could you please share a little more info about the error you're encountering? A screenshot of your code and/or a link to the specific challenge you're having trouble with would be great. Thanks :)

Hi guys, thanks for the quick response. I worked out why I was getting the error and now seems to have fixed things so all good now.

Hi Chris! That's great to hear! Just let us know if you run into any additional issues. :)

In case anyone is getting the same error...in my case, I made a mistake in app/models/status.rb

It seems like a lot of the problems I've been facing were because i forgot to add a comma "," between 2 variables so I would advise other fellow learners to always check your commas. :)