|
This is a blog of mcr at sandelman.ca |
Thu, 04 Sep 2008Not obvious to me at first is that Foxy Fixtures in RoR, where you can specify a foreign key relationship by name, as in:
### in pirates.yml
reginald:
name: Reginald the Pirate
monkey: george
### in monkeys.yml
george:
name: George the Monkey
pirate: reginald
Depends upon the fact that you didn't include id: in the fixtures. That is, RoR is not looking into the pirates.yml file to find the "reginald" fixture, and then inserting the "id" from it in. Rather, it's applying a hash of the string "reginald" to get the id, and so the id: of reginald had better be derived in the same way. posted at: 11:19 | path: /ruby-on-rails | permanent link to this entry
|
|
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||