Scala - calling foreach on a Seq to populate sample data

I just saw the following Scala source code in a Play Framework 2 sample application, and it struck me as a nice example of how to call the foreach method on a Seq to populate some sample data:

  User("", "Guillaume Bort", "secret"),
  User("", "Maxime Dantec", "secret"),
  User("", "Sadek Drobi", "secret"),
  User("", "Erwan Loisant", "secret")

As you can see on the last line, this code calls the create method on a User object, and that method looks like this:

def create(user: User): User = {
  DB.withConnection { implicit connection =>
        insert into user values (
          {email}, {name}, {password}
      'email ->,
      'name ->,
      'password -> user.password

Nothing too Earth-shattering, just a clean example of how to use a Seq with foreach to populate some sample data in Scala. This simple technique can be very useful when writing unit tests.

To see more of this code, check out the Global.scala and User.scala files in the Zentasks project in the Play Framework 2.1 distribution.