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.

Priority for routes does not override resource statements

#5870

I have these routes

match 'subjects/new(/account/:account_id)' => "subjects#new", :as => :new_subject, :via => :get
resources :subjects

based on the priority it should process first statement and generate both these

new_subject_path(:account_id => 1) => subjects/new/account/1
new_subject_path => subjects/new

but it doesn't. the second one overrides the first one and does this

new_subject_path(:account_id => 1) => subjects/new?account_id=1
new_subject_path => subjects/new => subjects/new

Reported by so1oonnet · October 27th, 2010 @ 02:47 AM

State: invalid
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Andrew White
    Andrew White
    • State changed from new to invalid
    • Importance changed from to Low

    The generated url helpers from the resources call overwrite the one from the previous route. It's just like redefining a method. If you use url_for it will match the first route, e.g:

      url_for(:controller => 'subjects', :action => 'new', :account_id => 1)
    

    October 27th, 2010 @ 03:27 AM