我需要将额外的参数传递给工厂女孩以在回调中使用。像这样的东西(但实际上更复杂):
Factory.define :blog do |blog|
blog.name "Blah"
blog.after_create do |blog|
blog.posts += sample_posts
blog.save!
end
end
然后用这样的东西创建它:
Factory.create(:blog, :sample_posts => [post1, post2])
任何想法如何做到这一点?