From 13129b04e1071c1fa00f50f8ab3c90cfcf602592 Mon Sep 17 00:00:00 2001 From: Simone Carletti Date: Tue, 7 Feb 2012 16:19:22 +0100 Subject: [PATCH] Document build_list and create_list with runtime traits. --- GETTING_STARTED.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md index 55a93cd..18cf548 100644 --- a/GETTING_STARTED.md +++ b/GETTING_STARTED.md @@ -480,6 +480,24 @@ FactoryGirl.create(:user, :admin, :male, :name => "Jon Snow") This ability works with `build`, `build_stubbed`, `attributes_for`, and `create`. +`create_list` and `build_list` methods are supported as well. Just remember to pass +the number of instances to create/build as second parameter, as documented in the +"Building or Creating Multiple Records" section of this file. + +```ruby +factory :user do + name "Friendly User" + + trait :admin do + admin true + end +end + +# creates 3 admin users with gender "Male" and name "Jon Snow" +FactoryGirl.create_list(:user, 3, :admin, :male, :name => "Jon Snow") +``` + + Callbacks ---------