Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Reverse routes problem when Option is present? #187

futurechimp opened this Issue May 3, 2012 · 1 comment


None yet
2 participants

futurechimp commented May 3, 2012


I've been having a few problems today with reverse routing support.

This works, providing the expected redirect to:

val _id = UploadGroupDAO.insert(group)
 redirect("/uploads/show/" + _id.getOrElse(""))

I would expect this to work as well, and it sort of does:

 val _id = UploadGroupDAO.insert(group).toString
 redirect(url(uploadsShow, "id" -> _id))

This compiles OK, but redirects to:

Something else I'd think would work is this:

    val _id = UploadGroupDAO.insert(group)
    redirect(url(uploadsShow, "id" -> _id.getOrElse("")))

However this brings back a compiler error:

overloaded method value url with alternatives:
[error]   (route: org.scalatra.Route,params: Map[String,String],splats: Iterable[String])String <and>
[error]   (route: org.scalatra.Route,splat: String,moreSplats: String*)String <and>
[error]   (route: org.scalatra.Route,params: (String, String)*)String
[error]  cannot be applied to (org.scalatra.Route, (java.lang.String, Any))
[error]     redirect(url(uploadsShow, "id" -> _id.getOrElse("")))

I'll take a peek at this tomorrow, just figured I'd log it here before I forgot about it.


futurechimp commented May 4, 2012

@casualjim figures the problem is here:


...but I'm not familiar enough with the test structure yet to write a failing test, and then a change to make it pass.

@casualjim casualjim closed this in 8aae79c May 4, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment