別の入力で2つのアクションを作成し、一方が他方を呼び出せるようにします。
def showQuestion(questionId :Long)=Action{
Redirect(routes.Application.showQuestion(Question.find.byId(questionId)))
}
def showQuestion(question :Question)=Action{
Ok(views.html.show(question))
}
私は上記を試しましたが、運がありませんでした。コンパイラが文句を言う:
found : models.Question
[error] required: Long
[error] Redirect(routes.Application.showQuestion(Question.find.byId(questionId)))
最初のものを参照します。