FactoryGirl: attributes_for not giving me associated attributes

前端 未结 7 636
再見小時候
再見小時候 2020-12-08 14:08

I have a Code model factory like this:

Factory.define :code do |f|
    f.value \"code\"
    f.association :code_type
    f.association(:codeable, :factory =&         


        
7条回答
  •  天命终不由人
    2020-12-08 14:46

    heres what I end up doing...

    conf = FactoryGirl.build(:conference)
    post :create, {:conference => conf.attributes.slice(*conf.class.accessible_attributes) }
    

提交回复
热议问题