Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routes with the same name break the URL generator #820

Closed
Wardrop opened this issue Mar 31, 2012 · 2 comments
Closed

Routes with the same name break the URL generator #820

Wardrop opened this issue Mar 31, 2012 · 2 comments
Labels
Milestone

Comments

@Wardrop
Copy link

Wardrop commented Mar 31, 2012

Routes that have the same name, but which have a different signature, cause the URL generator to think the route doesn't exist. For example:

controller :allocation do
  get :index {}
  get :index, :with => :id {}
end

url(:allocation_index) #=> Raises exception: route mapping for url(:place_index) could not be found!
url(:allocation_index, :id => 2) #=> Works just fine

I had expected Padrino to support routes with different signature for url generation, but this does not seem to be the case. I'm not sure if this is a bug, an oversight, or by design, but I believe Padrino should handle this case as there's no reason it couldn't.

Tom

@skade
Copy link
Contributor

skade commented Apr 1, 2012

This is true, routes are only generated by name and the second definition wins. There are several issues with the router, which is why we are planning a rework.

I'll add your request to the routing rework ticket and leave it open:

#747

@Ortuna
Copy link
Member

Ortuna commented Jun 26, 2013

Tried with this app @ HEAD

 module Test
   class App < Padrino::Application
     register Padrino::Rendering
     register Padrino::Mailer
     register Padrino::Helpers

     controller :allocation do
         get :index do; end
         get :index, :with => :id do; end
     end

         p url(:allocation_index) 
         p url(:allocation_index, :id => 2)
   end
 end

This bug was fixed it seems.

@Ortuna Ortuna closed this as completed Jun 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants