This project is archived and is in readonly mode.

#3072 ✓invalid
Manfred Stienstra

Namespaces routes and deprecation warnings

Reported by Manfred Stienstra | August 19th, 2009 @ 10:58 AM

When I have the following routes:

map.namespace :manage do |manage|
  manage.resources :editions do |edition|
  manage.resources :events do |event|
    event.resources :editions

And I call manage_event_editions_url(event), I get the following warning:

DEPRECATION WARNING: The URL you generated will use the first matching route
in routes.rb rather than the "best" match. In Rails 3.0
/manage/editions?event_id=26351010 will be generated instead of

I'm not sure whether this is a problem with the deprecation warning or with the actual routing code.

Comments and changes to this ticket

  • David Trasbo

    David Trasbo June 20th, 2010 @ 02:40 PM

    • Assigned user set to “Ryan Bigg”

    It's a problem with your routes file. You simply need to move the manage.resources :events do |event| block above the editions resource.

    Versions prior to Rails 3.0 would look through the entire routes file every time it had to generate a URL and find the "best" match. "Best" basically means that if there are two options, one with query strings and one without, the one without is preferred.

    In your case it hits it hits the manage.resources :editions and goes "hey, this route matches if we put an event_id query string at the end", where old Rails would hit the event.resources :editions line and go "hey, this is a perfect match, no query strings!"

    This ticket can be closed.

  • Rohit Arondekar

    Rohit Arondekar June 20th, 2010 @ 02:45 PM

    • State changed from “new” to “invalid”

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>