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

Comments

Projects
None yet
2 participants
@tayler1

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

This comment has been minimized.

Show comment
Hide comment
@namusyaka

namusyaka Mar 6, 2016

Member

@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?

Member

namusyaka commented Mar 6, 2016

@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

This comment has been minimized.

Show comment
Hide comment
@tayler1

tayler1 Mar 12, 2016

Yes. It is now as expected. Thank you.

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