Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why TODO in controllers sometimes can't be compiled, in play2?

TODO is convenient when coding controllers:

object Application extends Controller {

   def test = Action { TODO }

}

It's fine. But this:

def login = Action { implicit request => TODO }

It won't pass the compilation, the error message is:

type mismatch; found : play.api.mvc.Action[play.api.mvc.AnyContent] 
required: play.api.mvc.Result

I have to remove the iplicit request part, or use Ok("todo") instead, which is not convenient.

How to fix it or do I miss something?

like image 610
Freewind Avatar asked Mar 16 '12 03:03

Freewind


1 Answers

As Guillaume Bort said in google group, it's actually an Action, not a result. So we should use it as:

def test = TODO
like image 115
Freewind Avatar answered Nov 13 '22 13:11

Freewind