Skip to content

Instantly share code, notes, and snippets.

@mikesname
Created February 11, 2015 14:30
Show Gist options
  • Save mikesname/7baece8eb46e7f8e4a3c to your computer and use it in GitHub Desktop.
Save mikesname/7baece8eb46e7f8e4a3c to your computer and use it in GitHub Desktop.
Play Slick question
import play.api.db.slick.DB
def allSamplesJson = Action { implicit request =>
request.session.get("l").map {
case "i" => DB.withSession { implicit dbs =>
val all = models.CodeSampleTable.allSamples()
Ok(Json.toJson(all))
}
case _ => Unauthorized(unautStr)
}.getOrElse {
Unauthorized(unautStr)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment