Ruby On Rails

Back to -Products -Sapphire-IDE -FAQ -Ruby On Rails

Error: "uninitialized constant ApplicationController (NameError)"

When I run or debug my Rails application, I see a message stating: "\myrailsapp_controller.rb:1: uninitialized constant ApplicationController (NameError)"

It appears that you are trying to run the open Ruby source file rather than the Rails application. The individual source files in Rails apps are not runnable in this way. You need to run the application either by using the One-Click Rails Debugger on the Ruby menu or by altering the behaviour of F5 (and CTRL+F5) to run a Rails application rather than the active source file.

To make F5 run the entire application (when a Rails project is loaded) uncheck ’F5 starts Ruby’ in Tools->Options->Debugging->Ruby In Steel. The behaviour of F5 and CTRL+F5 will remain unaffected when running non-Rails programs (they will run or debug the active file). The One-Click Rails Debugger will always attempt to debug the Rails application, no matter which setting you have for F5.

© SapphireSteel Software 2014