Hi,
I try to use fixtures to populate my db (I can't find any best practice on rails + populating db values).
In my particular case, I have a model called App, and another called Category.
Both has children classes using STI (resp. PcApp, MobileApp and PcCategory, MobileCategory).
Here's some example fixtures for apps.yml :
google_mobile:
name: Google
icon: google.png
pc_categories: search_mobile,wap_mobile
url: http://www.google.fr
type: MobileApp
google_pc:
name: Google
icon: google.png
pc_categories: search_pc
url: http://www.google.fr
type: PcApp
and for categories.yml :
search_mobile:
name: Search
type: MobileCategory
wap_mobile:
name: Wap
type: MobileCategory
search_pc:
name: Search
type: PcCategory
in each subclass (PcApp or MobileApp), I have a habtm relationship to respective category. When using these relations inside the console, everything goes fine, and db is populated corrected.
But, When using the rake db:fixtures:load, I will get in apps_categories only the very last category used.
I mean, if the last entry type in apps.yml a is PcApp with PcCategories, I will have only PcCategories in apps_categories.
Since it's working by hand, and the problem only occurs with rake db:fixtures:load, I think there's a bug there.