This project is archived and is in readonly mode.
Priority for routes does not override resource statements
Reported by so1oonnet | October 27th, 2010 @ 02:47 AM
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
Comments and changes to this ticket
-
Andrew White October 27th, 2010 @ 03:27 AM
- 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)
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>