You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suppose you want to use something similar to named routes in rails ?
barista doesn't support that out of the box, but you could easily make a wrapper around router.url by storing the corresponding route_name -> router.url's params in an object
varnamed_routes={post: {controller: "post",action: "getOne"},/* ... */};functionpath_to(name,params){/* merge of passed params and `named_routes[name]` */returnrouter.url(params);}
you could even automatically register view helpers for your named routes.
Cool project that it would be... :)
Thank you, JeanSebTr, but i've already wrote my own implementation of this function with blackjack and hookers)
It would be nice if you apply this in barista router
And, i have superficially studied the router and noticed that the routes are stored in the numbered array.
It will be twice faster if store routes in key-value object, where key is name of route.
Hope you will hear me:)
Can i generate URL by name?
The text was updated successfully, but these errors were encountered: