playframework/Play20 — comment on commit f35fd305d98038ab0fe3f8076368ee7f8d90015b
File:  line 0
By recalcitrant:

Thanks again, now I get the same thing inside an Option, just as expected, but still, how do I extract the User-Object out of the
Parser?

anorm.ResultSetParser[Option[models.auth.User]]

val user = User.byId(42).getOrElse(...)

def byId(id: Long): Option[User] = DB.withConnection(implicit connection =>
SQL(sql + "and ua.id = {id}" + order).on("id" -> id).as(User.withPermissions.singleOpt))

val withPermissions = (User.instance ~ Permission.instance
*).map(_.groupBy(_._1).toSeq.headOption.map {
case (u, ps) => u.copy(permissions = ps.map(_._2).toSet)
})

Compiler Output:

value singleOpt is not a member of anorm.ResultSetParser[Option[models.auth.User]]