Whose Error Is It?

Ruby printed this

NoMethodError: undefined method `name' for nil:NilClass
What it meansYou called the name method on a value that is nil, so the object you expected, often the result of a record lookup, does not exist.
The first thing to checkCheck the line where the receiver came from, often a find_by or hash lookup that returned nil; guard with &.name or handle the missing case.
The walrus saysRuby calls nil a NilClass and means it.

More from Ruby

All 75 errors

Whose Error Is It? · Status Menu · Back to the bar