I am trying to pass a list of questions into a template in Play 2.0.
The controller code looks like this:
List<Question> questions = Question.findAll();
return ok(questions.render("Here are all the questions", questions));
The Template constructor looks like this
@(message: String, questions: List[Question])
The template file is called questions.scala.html
I also use the questions list like this later in the template:
@questions_list(questions)
and the constructor for `questions_list.scala.html) looks like this:
@(questions: List[Question])
I am getting the compile error:
cannot find symbol [symbol: method render(java.lang.String,
java.util.List<models.Question>)]
[location: interface java.util.List<models.Question>]
I have tried cleaning and recompiling with no luck? Does anybody see whats wrong here?
OK so the problem was a naming collision between my template and the variable name I was assigning to the
List<Question>
. I think I may start naming my templates with uppercase to more properly illustrate that that they are classes when I am using them in controllers.