Try this:
case class User(id:Option[Long], name: String)
case class Account(id:Option[Long], userId: Option[Long])
object Account {
// apply method
def apply(i: Identity): Account = {
Account(None,None)
}
}
Pregunta
Say I have something like this:
case class User(id:Option[Long], name: String)
case class Account(id:Option[Long], userId: Long)
object Account {
// apply method
def apply(i: Identity): Account = {
Account(None,SomeFutureUserId)
}
}
This isn't working for some reason:
Account = Account(None,SomeUser.id)
How would I let Play! know that there will be a Long
type in place of id
? Something like a placeholder?
Solución
Try this:
case class User(id:Option[Long], name: String)
case class Account(id:Option[Long], userId: Option[Long])
object Account {
// apply method
def apply(i: Identity): Account = {
Account(None,None)
}
}