Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Reverse doesn't return correct route with multiple matches #806

Open
reubano opened this issue May 31, 2014 · 2 comments
Open

Reverse doesn't return correct route with multiple matches #806

reubano opened this issue May 31, 2014 · 2 comments

Comments

@reubano
Copy link

reubano commented May 31, 2014

routes.coffee

module.exports = (match) ->
  match '', 'site#index'
  match ':type', 'site#index'
  match ':type/page/:num', 'site#index'

these all return urls of /

  console.log Chaplin.utils.reverse 'site#index'
  console.log Chaplin.utils.reverse 'site#index', type: 'blog'
  console.log Chaplin.utils.reverse 'site#index', {type: 'blog', num: 1}

should be this

/
/blog
/blog/page/1
@paulmillr
Copy link
Contributor

you can use different route names and that would work

@reubano
Copy link
Author

reubano commented Jun 2, 2014

That's fine as a workaround. But since the blog routes direct to the same page, this is still a bug. Correct? E.g. I should be able to go to /blog or /blog/page/1` and still get the first blog page without needing a new route name.

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

No branches or pull requests

2 participants