Hi,…
I am having trouble with label reference in fixtures…
I have two fixtures like this :
cars.yml
one:
name: Ferari
two:
name: Volvo
drivers.yml
one:
name: Stall
car: Ferari
‘Drivers’ table have a ‘belongs_to’ clause to the ‘cars’ table, vice
versa with ‘has_many’
Evertime i am running my test, and access the ‘drivers(:one).car’, I
always get nil result.
Can some one tell me where my mistake?
Thanks in advance,
On Oct 14, 8:34 am, Stallion [email protected] wrote:
name: Volvo
drivers.yml
one:
name: Stall
car: Ferari
‘Drivers’ table have a ‘belongs_to’ clause to the ‘cars’ table, vice
versa with ‘has_many’
That should be car: one - You reference the fixture label, not any of
the data inside it.
Fred
2009/10/14 Stallion [email protected]:
Hi,…
I am having trouble with label reference in fixtures…
I have two fixtures like this :
cars.yml
one:
 name: Ferari
This should be
Ferari:
name: Ferari
two:
 name: Volvo
drivers.yml
one:
 name: Stall
 car: Ferari
The Ferari here refers to Ferari: above, not to the name field, which
is a column in the db. They need not be the same.
Colin
On Wed, Oct 14, 2009 at 4:55 AM, Frederick C.
[email protected] wrote:
two:
That should be car: one - You reference the fixture label, not any of
the data inside it.
And I’d recommend making the ‘ids’ more intention revealing
cars.yml
luigis_car:
name: Ferari
svens_car:
name: Volvo
drivers.yml
luigi:
name: Stall
car: luigis_car
–
Rick DeNatale
Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale