3
file 1 . user.rb
factory :user do
name "test"
end
factory :admin_user, :parent => user do
role "admin"
end
file 2. manager.rb
factory :manager do
association :admin_user
description "manager"
end
and while run FactoryGirl.create(:manager), it will show NoMethodError:
undefined method `admin_user=' for #<Manager ....
它的作品!謝謝! –