azalut
azalut

Reputation: 4234

How to obtain flash scope - Play Framework with Scala, maximum arguments in template

I read book play with scala written in 2013 and I have already found some problems with the latest play version. One of them was i18n Messages, which I successfully solved. But now I meet another problem, which is:

Author explains flash scope. And in the example in the book there is something like: (inside main.scala.html template)

@(title: String)(content: Html)(implicit flash: Flash)

But in my code it must be:

@(title: String)(content: Html)(implicit messages: Messages)(implicit flash: Flash)

And here's the problem. When I add (implicit flash: Flash) I recieve an error by my IDE (IntelliJ IDEA) which is: "wrong top statement declaration"

I suppose that template has its maximum number of parameters (templates are functions as far as I know) so I cant add one more. The question is how to obtain flash scope object?

Please explain to me the idea of these parameters. Thanks!

Upvotes: 0

Views: 534

Answers (1)

grotrianster
grotrianster

Reputation: 2468

There can be only one implicit parameter list in a function and must be the last one, like this: @(title: String)(content: Html)(implicit messages: Messages, flash: Flash)

Upvotes: 2

Related Questions