次の Factory 定義があります。
Factory.define :status do |f|
end
Factory.define :my_status , :parent => :status do |f|
f.association 'something_here'
f.alias 'something_here'
f.name 'something_here'
end
f.association :group, :factory => :group のようなファクトリ定義の「関連付け」メソッドについて知っています。しかし、実際には関連付けという名前の列があります。列に値を割り当てるにはどうすればよいですか?
更新: Maletor の投稿の後、1 つの解決方法が思い浮かびました。Maletor に感謝します。
これをステータスモデルに追加しました
alias_attribute :assoc, :association
そして今、私はできる
Factory.define :my_status , :parent => :status do |f|
f.assoc 'somthing_here'
f.alias 'somthing_here'
f.name 'somthing_here'
end
正常に動作します :)