传递case类的数组时参数太多

时间:2016-03-11 12:05:13

标签: scala playframework

我有以下case class

case class Question(content:String, answer:String)

object Question {
  implicit val format: Format[Question] = Json.format[Question]
}

在控制器中,我正在创建questions类型的对象Array[Question]

我将它传递给这样的视图:

Ok(views.html.questions(Json.toJson(questions)))

但是,我在传递时遇到此错误:

too many arguments for method apply: ()play.twirl.api.HtmlFormat.Appendable in class questions

视图如下所示:

import basicQG.question

@(questions: Array[Question])

@main("Answer these questions") {
}

我可以通过其他方式将Array[Question]传递给视图吗?

1 个答案:

答案 0 :(得分:0)

当我改变

时,错误就消失了
ggplot(aes(x = paste(yta, beh, sep = ":"), y = value, fill = variable), data = thin50) + 
  stat_summary(fun.y = mean, geom = "bar", position = "stack") +
  #scale_fill_grey() + 
  scale_fill_manual(values=c("black", "lightgrey", "darkgrey")) +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  theme(axis.line = element_line(colour = "black"),
        axis.text = element_text(color = "black"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        panel.background = element_blank(),
        legend.position = "none",
        text = element_text(size=14, color = "black", vjust = 0.5)) +
  labs(x = "Experiment : treatment", y = expression(m^3))

import basicQG.question