之间的差异在超我定义的函数:斯卡拉理解这两个函数
def render(model: JsonModel) {
if (!model.isOk()) {
BadRequest(model.toJsonString()).withHeaders("Content-Type" -> "application/json; charset=utf-8")
} else {
Ok(model.toJsonString()).withHeaders("Content-Type" -> "application/json; charset=utf-8")
}
}
我想调用这个函数在我的子类:
def test(model: JsonModel) = Action { implicit request =>
render(model)
}
这不工作,抱怨 - 类型不匹配;发现:股需要
,如果我摆脱隐含请求
def test(model: JsonModel) = Action {
render(model)
}
看来工作,但我有时我需要访问请求
请添加*完整*错误消息。 – 2011-12-22 01:28:07