I have the following play2 code:
implicit def contextToRequest(rc: RequestContext[_]) = rc.request
implicit def contextToFlash(rc: RequestContext[_]) = rc.request.flash
implicit def contextToSession(rc: RequestContext[_]) = rc.request.session
def login: Action[AnyContent] = PublicAction { implicit rc =>
Ok(html.login(loginForm))
}
RequestContext
is my own custom class wrapper of the Play2 Request
.
My scala view starts with:
@(form: Form[(String,String,Boolean)])(implicit flash: Flash, session: Session,rc: utils.RequestContext[_])
But the compiler says:
could not find implicit value for parameter flash: play.api.mvc.Flash
Can someone explain to me why it doesn't work? Perhaps we can't use implicit conversions for implicit parameters?
Then can someone explain to me why there is already a working implicit conversion from the Play2 request to Session/Flash and when I do it it doesn't work?