Skip to content

Commit

Permalink
Document build_list and create_list with runtime traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
weppos authored and joshuaclayton committed Feb 8, 2012
1 parent 6482a64 commit 13129b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions GETTING_STARTED.md
Expand Up @@ -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
---------

Expand Down

0 comments on commit 13129b0

Please sign in to comment.