weird unicorn_rails issue...

Eric Wong normalperson at
Wed Oct 14 18:15:52 EDT 2009

Hi all,

I just had a user on Rails v2.3.2 that had trouble[1] with the
out-of-the-box unicorn_rails, but was worked around by using the
following RAILS_ROOT/ file with plain "unicorn" and
manually setting RAILS_ENV in the shell environment

  require 'config/environment'
  use Rails::Rack::LogTailer
  map("/") do
    use Rails::Rack::Static

script/server + WEBrick worked out-of-the-box, as well.

Oddly, the same file does not work with "unicorn_rails",
either (even when the "" file is explicitly specified);
only with "unicorn".

So I'm a bit perplexed...

[1] - by "trouble", I mean the app became very subtly broken.  Query
parameters (it was a GET request) appeared to be handled correctly, but
the app was not returning the same results.  I looked briefly at the
app and noticed *something* was a bit suspicious:

    -------------- app/controllers/foo_controller.rb -------------
    class FooController < ApplicationController
      def index
        all_params = some_weird_params_generated
        results =
    -------------- app/controllers/bar_controller.rb -------------
    class BarController < ApplicationController
      def action(all_params)

That is, it creates a new controller from within one controller inside
one action.  Note that I'm not 100% certain this responsible for the
breakage we were seeing, but it certainly does look like suspicious
Rails code to me.

I haven't decided if I'll spend time to fix/debug this, but at least
I'll document it here if somebody wants to look into it further.

Eric Wong

More information about the mongrel-unicorn mailing list