Skip to content

Commit

Permalink
Update GETTING_STARTED: include note about saving in create_list (#…
Browse files Browse the repository at this point in the history
…1522)

Fixes #1444 and #1479

Add a short note in GETTING_STARTED.md about the need to save the record
after it has been modified
  • Loading branch information
rgould authored Jan 14, 2022
1 parent b7eb4db commit fc098ff
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,15 @@ twenty_somethings = build_list(:user, 10) do |user, i|
end
```

`create_list` passes saved instances into the block. If you modify the instance, you must save it again:

```ruby
twenty_somethings = create_list(:user, 10) do |user, i|
user.date_of_birth = (20 + i).years.ago
user.save!
end
```

`build_stubbed_list` will give you fully stubbed out instances:

```ruby
Expand Down

0 comments on commit fc098ff

Please sign in to comment.