Question

I use scala+play2+slick2:

val subject = TableQuery[Subjects]

subject is my tableQuery

in controller I defined a functional:

import scala.slick.driver.PostgresDriver.simple._
def index = DBAction {implicit rs =>

Ok(views.html.list_subject.render("Hello from Scala", (subject.drop(0).map(i => (i.id, i.name, i.describe,i.sub_resource)).run)
    ))
}

the error is:

[info] Loading project definition from G:\testprojects\slickplay\project
[info] Set current project to slickplay (in build file:/G:/testprojects/slickpla
y/)
[info] Compiling 6 Scala sources to G:\testprojects\slickplay\target\scala-2.10\
classes...
[error] G:\testprojects\slickplay\app\controllers\MainController.scala:12: could
not find implicit value for parameter session: scala.slick.jdbc.JdbcBackend#Ses
sionDef
[error]     Ok(views.html.list_subject.render("Hello from Scala", (subject.drop(
0).map(i => (i.id, i.name, i.describe,i.sub_resource)).run)
[error]
                                                   ^
[error] one error found
[error] (compile:compile) Compilation failed
[error] Total time: 9 s, completed 11/04/2014 2:23:57 PM

Is there any example with scala+play2+slick2 and use Form? Any one know how to return the (i.id, i.name, i.describe,i.sub_resource) list?

Was it helpful?

Solution

try importing

import play.api.db.slick._
import play.api.db.slick.Config.driver.simple._

if you are using DBAction, which I presume from play-slick plugin

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top