Play template only works when called with parentheses

Viewed 1321

I have the following code in my Application controller:

  def index = Action {
    var ticketsAvailable = 1
    Ok(views.html.index)
  }

When I try to run the application, I get this compilation error:

Cannot write an instance of views.html.index.type to HTTP response. Try to define a Writeable[views.html.index.type]

On the line

Ok(views.html.index) 

However, when I add parentheses (as shown below), the error disappears:

Ok(views.html.index()) 

Why is that? I thought that, in Scala, the usage of parentheses is optional when there are no arguments.

1 Answers
Related