为什么插入方法永远不会被调用?

时间:2014-02-13 21:26:39

标签: scala playframework playframework-2.0 fold

此代码编译但从未调用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)
  }

0 个答案:

没有答案