Advertisement
Guest User

Untitled

a guest
Apr 29th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.31 KB | None | 0 0
  1.   def add(value: String, maybeDescription: Option[String] = None): Try[Int] = {
  2.     if (findByValue(value).isDefined)
  3.       Failure(new RuntimeException)
  4.     else {
  5.       val newId = (models returning models.map(_.id)) += makeObject(value = value, description = maybeDescription)
  6.       Success(newId)
  7.     }
  8.  
  9.  
  10.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement