此代码编译但从未调用Environment.insert
。我确定那里有一个envrionmentForm
。
//isauth version of save
def save(SystemId: Long) = IsAuthenticated { username => implicit request =>
User.findByEmail(username).map { user =>
System.findById(SystemId).map { system =>
environmentForm.bindFromRequest.fold(
formWithErrors => BadRequest(html.env_views.createForm(formWithErrors, system, Person.options, user)),
env => {
Environment.insert(env)
Application.Home.flashing("success" -> "Environment %s has been created".format(env.env_name))
}
)
}.getOrElse(Forbidden)
}.getOrElse(Forbidden)
}