我正在使用FactoryGirl 4.4版.我正在尝试创建after(:create)回调,但是我在评估器变量上失败.
FactoryGirl.define do factory :organization do name 'example' factory :organization_with_links do transient do links_count 5 end after(:create) do |organization,evaluator| create_list(:link,evaluator.links_count,organization: organization) end end end end
不幸的是我得到了
NoMethodError: undefined method `links_count' for FactoryGirl::SyntaxRunner:0x007fcefb1ff780>
根据officall工厂女孩指导我正在做的一切正常:https://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#associations
任何建议如何使瞬态变量工作?