September 19, 2007
Confusing Rails Error Message
<code>
ArgumentError: Admin is not missing constant UsersController!
method load_missing_constant in dependencies.rb at line 240
method const_missing in dependencies.rb at line 452
method send in dependencies.rb at line 470
method const_missing in dependencies.rb at line 470
method setup_without_fixtures in users_controller_test.rb at line 11
method setup in fixtures.rb at line 576
</code>
<code>
ArgumentError: Admin is not missing constant UsersController!
method load_missing_constant in dependencies.rb at line 240
method const_missing in dependencies.rb at line 452
method send in dependencies.rb at line 470
method const_missing in dependencies.rb at line 470
method setup_without_fixtures in users_controller_test.rb at line 11
method setup in fixtures.rb at line 576
</code>
Note to self: the above error message normally means that you are missing the scope prefix and the :: operator. So in the above example the error would be fixed by prepending “Admin::” to the reference to the class “UsersController” on line 11 of users_controller_test.rb.
More Articles on Software & Product Development
- Agile With a Lowercase “a”
- ”Agile“ is an adjective. It is not a noun. It isn’t something you do, it is something you are.
- How Do You End Up With A Great Product A Year From Now?
- Nail the next two weeks. 26 times in a row.
- Build it Twice
- Resist the urge to abstract until you've learned what is general to a class of problems and what is specific to each problem.