trivektor
trivektor

Reputation: 5638

Play Framework (Scala) Template

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.

Upvotes: 0

Views: 433

Answers (1)

Philippe
Philippe

Reputation: 9742

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.

Upvotes: 1

Related Questions