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.

This project is archived and is in readonly mode.

an RoutingError of prefix path

#1314

The newest Rails 2.2rc1 seems to have a routing error if it's used with a URL prefix.

After creating a new app named msp, if I used the command


ruby script/server
or
mongrel_rails start

to start the app, everything is well. But, when I used the command


mongrel_rails start --prefix /msp

an ActionController::RoutingError raised and the log report


ActionController::RoutingError (No route matches "/msp/users/1" with {:method=>:get}):
    /usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.0/lib/action_controller/routing/recognition_optimisation.rb:66:in `recognize_path'
    /usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.0/lib/action_controller/routing/route_set.rb:385:in `recognize'
    /usr/local/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.0/lib/action_controller/dispatcher.rb:179:in `handle_request'

When it's deployed to the phusion passenger, the result is almost same.

Reported by richy zhang · November 1st, 2008 @ 02:13 AM

State: committed
Milestone: none
Assigned to: Michael Koziarski Michael Koziarski
Importance: none

Activity

  1. Michael Koziarski
    Michael Koziarski

    Which version of mongrel do you have installed? The code appears to be correct in 1.1.5?

    November 2nd, 2008 @ 09:18 AM

  2. Michael Koziarski
    Michael Koziarski
    • Milestone cleared.
    • Assigned user set to Michael Koziarski

    We may need to add a work around for this before 2.2 final. Or provide patches upstream as needed

    November 2nd, 2008 @ 09:18 AM

  3. richy zhang
    richy zhang

    I use mongrel (1.1.5). The routing error raises only when mongrel is start with the opinion --prefix /msp . Without the opinion, I don't find any problems.

    Now I put ENV['RAILS_RELATIVE_URL_ROOT']="/msp" in the environment.rb as Hongli Lai suggested, and msp can be deployed to passenger.

    November 2nd, 2008 @ 11:32 AM

  4. Michael Koziarski
    Michael Koziarski

    Hopefully this patch resolves it for you?

    November 2nd, 2008 @ 12:11 PM

  5. Michael Koziarski
    Michael Koziarski

    I've applied this patch as of 8a53e25

    You should be able to freeze to edge and it should all work, alternatively that patch should apply cleanly to your rc1 checkout.

    November 2nd, 2008 @ 12:14 PM

  6. Michael Koziarski
    Michael Koziarski
    • State changed from new to committed

    November 2nd, 2008 @ 12:14 PM

  7. richy zhang
    richy zhang

    I find out that "ActionController::base.relative_url_root=relative_url_root" should be ::Base.

    In the other hand, it works well with 'mongrel_rails start --prefix="/msp" ' , but it's broken with phusion passenger even if I provide ENV['RAILS_RELATIVE_URL_ROOT'].

    November 3rd, 2008 @ 01:18 AM