chaplinjs/chaplin

Reverse doesn't return correct route with multiple matches

reubano opened this issue · 2 comments

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

you can use different route names and that would work

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.