The Application Controller in Rails 2.3 has been renamed to application_controller.rb, whereas previously it was application.rb. If you don’t fix it, calling any controller will return this cryptic error.
NameError in MyController#search
uninitialized constant ApplicationController
After trying to fix this by checking out an older revision, reconfiguring Mongrel/Apache and generally turning things on & off, I discovered the fix.
rake rails:update
That was all it needed! The Rake task will rename the file accordingly, and instructs you to update your source code repository. I guess it serves me right for not using the same Rails version on my development and production servers. On development I use 2.2.2 and on production I upgraded to 2.3. A point release can be a big difference!
Hope this saves you some desperately late nights.
Leave a Reply