Permalink
Browse files

Re: #431 -- Added a note about `strategy: :build`

  • Loading branch information...
1 parent 71c1336 commit fd56f884e4093339c6ef81a70746ea9672c2802e @hosamaly hosamaly committed with joshuaclayton Sep 7, 2012
Showing with 9 additions and 0 deletions.
  1. +9 −0 GETTING_STARTED.md
View
@@ -336,6 +336,15 @@ post.new_record? # => true
post.author.new_record? # => true
```
+Please note that the `strategy: :build` option must be passed to an explicit call to `association`,
+and cannot be used with implicit associations:
+
+```ruby
+factory :post do
+ # ...
+ author strategy: :build # <<< this does *not* work; causes author_id to be nil
+```
+
Generating data for a `has_many` relationship is a bit more involved,
depending on the amount of flexibility desired, but here's a surefire example
of generating associated data.

0 comments on commit fd56f88

Please sign in to comment.