i am getting some problem in Fixtures
I am having models advantage and kind
advantage.rb
belongs_to :kind
kind.rb
has_many :advantages
advantages.yml
1.
id: 1
title: something
kind: apple
kind_id: 1
2.
id: 2
title: somethjin
kind: orange
kind_id: 2
kinds.yml
apple:
id: 1
name: apple
orange:
id: 2
name: orange
I am trying to bring association here as kind_id is coming with some junk values
so i did like
kinds.yml
apple:
name: apple
orange:
name: orange
and in advantages.yml
something:
title: something
kind: apple
somethjin
title: somethjin
kind: orange
But it didn't work
How to resolve this
Try like this but not sure:
kinds.yml apple: id: 1 name: 'name1' orange: id: 2 name: 'name2' advantages.yml adv1: id: 1 title: 'title1' kind: apple
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With