Fork me on GitHub

Hi I would like to know how I can handle an optional param like below

   [["/editor" :editor]
    ["/editor/:slug" :editor]])


I guess I could have :editor and :editor-slug but is there a way to say slug does not have to exist


this is using the frontend routing, but i imagine the syntax is the same for both

Steven Deobald16:12:31

@oliver.marks I think your options are {:conflicts nil} for all routes or {:conflicting true} for a specific route.


@steven427 thanks I thought would be a better way than that 😕


although :editor :editor-slug did work and having them both call the same view function


just felt like there should be a better way would explain why I could not find it in the docs as well

Steven Deobald17:12:41

@oliver.marks Oh, sorry. I missed half your question. Yeah, I was actually just doing something similar (sort of the inverse of your problem with :editor) yesterday because I want to replicate Rails’ resource-oriented named-route lookups. I ended up hacking up an :alias feature for the path lookup: That way I can do something like (path-for request :show id) and (path-for request :destroy id) and they both return the same path: "/images/:id"