Scala Play重载方法值[保存]无法应用

时间:2014-02-19 10:46:40

标签: mongodb scala playframework save

获取重载方法值[save]无法应用于(models.UserReset)

模特:

case class UserReset (
  id: ObjectId = new ObjectId,
  userId: ObjectId,
  email : String,
  key : String,
  used : Boolean = false,
  createDate: Date = new Date()
)

控制器:

//save reset info
val userResetVal = UserReset(userId = user.id, email = user.email, key = resetLink)
User.save(userResetVal)

不确定为什么?或者我应该在val userResetVal = UserReset(userId = user.id,email = user.email,key = resetLink)中包含Id,Used和createDate?

1 个答案:

答案 0 :(得分:0)

您希望UserReset成为User的单独模型吗?在这种情况下,您还需要

object UserReset {
  // define the corresponding table structure 
  // and methods including save
}

并致电

UserReset.save(userResetVal)