Saturday, November 29, 2008

Troubleshooting - 02 - Uninitialized Constant

Error Message: 
Uninitialized Constant BlahBlah (NameError)
Error Stage:
Development
Error Location: 
Code has a reference to a name starting with an UPPERCASE (CAPITAL) character and it was referenced (used in right hand side of assignment, OR as a input parameter in a method etc) even though no value was assigned yet.
Error Detail: 
Names starting with UPPERCASE characters in Ruby indicates constants.
Error Fix: 

Fix the constant so that it gets a value assigned before referencing it.
Error Fix2: 

If the name is not expected to be constant, rename it accordingly.

No comments: