Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

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

#109

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)

Reported by Arrix Zhou · August 29th, 2009 @ 09:03 PM

State: resolved
Milestone: Future
Assigned to: macournoyer macournoyer

Activity

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.