#109 ✓resolved
Arrix Zhou

Rails adapter chooses CgiApp over ActionController::Dispatcher in ruby 1.8

Reported by Arrix Zhou | August 29th, 2009 @ 09:03 PM | in Future

In my testing with ruby 1.8.7 and Rails 2.3.3, @rails_app has the type Rack::Adapter::Rails::CgiApp instead of the Rack compliant ActionController::Dispatcher.

In thin/lib/rack/adapter/rails.rb at line 25

        @rails_app = if ActionController.const_defined?(:Dispatcher) && ActionController::Dispatcher.instance_methods.include?(:call)
          ActionController::Dispatcher.new
        else
          CgiApp.new
        end

In ruby 1.8, Object#instance_methods returns an Array of Strings (while ruby 1.9 returns an Array of Symbols) so include?(:call) always returns false.

A possible fix is ActionController::Dispatcher.instance_methods.map{|m| m.to_sym}.include?(:call)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Referenced by

Pages