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

Default fallback routing and mapping #2007

Closed
tayler1 opened this issue Feb 27, 2016 · 2 comments
Closed

Default fallback routing and mapping #2007

tayler1 opened this issue Feb 27, 2016 · 2 comments

Comments

@tayler1
Copy link

tayler1 commented Feb 27, 2016

I don't get your new router.
Also I don't know is it https://github.com/namusyaka/mustermann19 or https://github.com/rkh/mustermann issue, I post it here.

  1. Consider this example
Sample::App.controllers :products do
  get :index do
    # url(:products, :index) => '/products'
  end

  get :index, :with => :id do
    # url(:products, :index, :id => 5) => '/products?id=5'
    # url broken, but accessing this route '/products/5' from browser works
  end
end

I got workaround for handling default routing without params, so...

  1. Next example (just rename route to get it work)
Sample::App.controllers :products do
  get :index do
    # url(:products, :index) => '/products'
  end

  get :item, :with => :id do
    # url(:products, :item, :id => 5) => '/products/item/5'
  end
end

It wasn't exactly what I wanted so...

Sample::App.controllers :products do
  get :index do
    # url(:products, :index) => '/products'
  end

  get :item, :map => "/products/:id" do
    # url(:products, :item, :id => 5) => '/products/5'
  end
  # or
  get :item, :parent => :products, :map => ":id" do
    # url(:products, :item, :id => 5) => '/products/5'
  end
end

Totally same as your example enhanced-routing
Why I need explicitly map route to "/products" or to parent? It's already in :products controller

get :index, :map => ":id" do
  # url(:products, :index, :id => 5) => '/5'
end
get :index, :map => "/:id" do
  # url(:products, :index, :id => 5) => '/5'
end

Isn't mapping :id and /:id should be different? First relative and second mapped to root.

@namusyaka
Copy link
Contributor

@tayler1 Thanks for the report!
This is not mustermann but padrino's issue.

Reported behavior seems working well in padrino-0.12.5, so I decided that the current behavior is a bug, and then I fixed the behavior.
Could you confirm the change on your project?

@tayler1
Copy link
Author

tayler1 commented Mar 12, 2016

Yes. It is now as expected. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants