0
votes

Can someone explain to me what the Template function does in the following code:

object Users extends Controller {   
    def show(id:Long) = Template("user" -> User.findById(id))
}

Thanks.

1
Could you maybe give more context, or point to a source somewhere?Philippe

1 Answers

1
votes

It's syntactic sugar to create a template. In this example, it is a call to the function:

def Template(args: (Symbol, Any)*)

(defined here). Itself just forwards the arguments to the ScalaControllerCompatibility object (same file), that rewrites them so that the method, finally, creates a Template instance.