我使用scala + play2 + slick2:
val subject = TableQuery[Subjects]
subject是我的tableQuery
控制器中的我定义了一个功能:
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)
))
}
错误是:
[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
scala + play2 + slick2是否有任何示例并使用Form?任何人都知道如何归还 (i.id,i.name,i.describe,i.sub_resource)列表?
答案 0 :(得分:2)
尝试导入
import play.api.db.slick._
import play.api.db.slick.Config.driver.simple._
如果您正在使用DBAction,我从play-slick plugin
中假设