FactoryGirl: attributes_for not giving me associated attributes

前端 未结 7 626
再見小時候
再見小時候 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:52

    You can try something like this:

    (Factory.build :code).attributes.symbolize_keys 
    

    Check this: http://groups.google.com/group/factory_girl/browse_thread/thread/a95071d66d97987e)

    0 讨论(0)
提交回复
热议问题