Skip navigation

I recently had the following error while configuring Nginx with Unicorn on Rails 2.3.8

in my, I had the following:

(taken from the Ruby on Rack instructions on the ‘official’ guide page, )
require “config/environment”

use Rails::Rack::LogTailer
use ActionDispatch::Static

This was giving the following annoying error when trying to start the unicorn server:

/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:443:in `load_missing_constant’: uninitialized constant ActionDispatch (NameError)
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:80:in `const_missing’
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/dependencies.rb:92:in `const_missing’
from /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/builder.rb:46:in `instance_eval’
from /usr/lib/ruby/gems/1.8/gems/rack-1.1.2/lib/rack/builder.rb:46:in `initialize’
from `new’

It turns out that a patch submitted to unicorn_rails gave the hint ( )

The fix was to replace the line #use ActionDispatch::Static with:
use Rails::Rack::Static

The new thus became:
use Rails::Rack::LogTailer
use Rails::Rack::Static

I am guessing this had to be done because ActionDispatch::Static isn’t present in this version of Rails.


One Comment

  1. Thanks for posting your solution! I was having the same issue (uninitialized constant ActionDispatch) setting up redmine 1.2 (actually current trunk) on ruby 1.8.7 and rails 2.3.14 behind nginx and unicorn. I too had used the example rackup config from the Rails on Rack guide.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: