Skip to content

Instantly share code, notes, and snippets.

@naoty
Last active October 30, 2017 08:52
Show Gist options
  • Save naoty/4701800 to your computer and use it in GitHub Desktop.
Save naoty/4701800 to your computer and use it in GitHub Desktop.
FactoryGirl.define do
factory :user do
after(:create) do |user|
FactoryGirl.create_list(:task, 10, user_id: user.id)
end
end
factory :task do
trait :with_user do
user
end
end
end
@naoty
Copy link
Author

naoty commented Feb 3, 2013

循環しそうなので、関連もちたい場合はtraitを使うようにすればいけそう

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment