So you’re happily developing a rails app, and for whatever reason need to restart your devel server.
And then you get this (paths removed to improve readability):
$ script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... Exiting .../vendor/rails/railties/lib/commands/servers/mongrel.rb:16: warning: already initialized constant OPTIONS .../vendor/rails/railties/lib/commands/servers/mongrel.rb:19: undefined method `options' for []:Array (NoMethodError) from /usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:32:in `require' from .../vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require' from .../vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in' from .../vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require' from .../vendor/rails/railties/lib/commands/server.rb:39 from script/server:3:in `require' from script/server:3
Googling for this error shows that Mongrel is eating the real error message. There are patches that have been committed to work around this – and guess what, your rails version already has those patches *and yet you still can’t see what’s going on*.
A number of underlying problems are suggested – missing dependencies/gems, problems with gems being renamed between rails versions, etc.
As Murphy would have it, the error could well be caused by something totally different.
There’s an easy way to find out. Don’t use ‘script/server’ to debug this. Just start your mongrels with mongrel_rails, which will tell you the problem right away, like it did for me:
$ mongrel_rails start ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... .../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:249:in `load_missing_constant': Expected .../app/controllers/admin/key_hosts_controller.rb to define Admin::KeyHostsController (LoadError) from .../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:453:in `const_missing' from .../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/inflector.rb:257:in `constantize' from .../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/string/inflections.rb:148:in `constantize' from .../vendor/plugins/hobo/lib/hobo/model_router.rb:91:in `add_routes_for' from .../vendor/plugins/hobo/lib/hobo/model_router.rb:82:in `each' from .../vendor/plugins/hobo/lib/hobo/model_router.rb:82:in `add_routes_for' from .../vendor/plugins/hobo/lib/hobo/model_router.rb:70:in `add_routes' from .../vendor/plugins/hobo/lib/hobo/model_router.rb:70:in `each' ... 28 levels... from /var/lib/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in `run' from /var/lib/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 from /var/lib/gems/1.8/bin/mongrel_rails:16:in `load' from /var/lib/gems/1.8/bin/mongrel_rails:16
I made a stupid mistake in app/controllers/admin/key_hosts_controller.rb. No problems with dependencies or gems at all.
I don’t know what’s up with script/server, but it needs some love. Badly.