hanami / router

Ruby/Rack HTTP router
http://hanamirb.org
MIT License
362 stars 92 forks source link

Optional tokens are not being accepted by 'path' #138

Closed sergey-koba-mobidev closed 7 years ago

sergey-koba-mobidev commented 7 years ago

Hi,

Thank you for nice gem! I am using it as standalone gem in my Rack app. I have such route in it: get '(/:lang)/article/:slug', lang: /en/, to: 'posts#show', as: :show_post

When I call @router.path(:show_post, slug: 'blabla') is works as expected. But trying to do @router.path(:show_post, slug: 'blabla', lang: 'en') raises exception: Hanami::Routing::InvalidRouteException: No route (path) could be generated for :show_post - please check given arguments

Maybe I am doing something wrong, or is it a bug? Thx in advance!

sergey-koba-mobidev commented 7 years ago

Sorry, figured out it was a constraint exception