I have the following seed file that creates many animals which are then added to the animal_store object
animal_store_seeder:
animal1 = create(:animal)
animal2 = create(:animal)
animal3 = create(:animal)
create(
:animal_store,
json: {
"animals": {
animal1.id=> {
},
animal2.id =>{
}
...
}
}
So far this works. However, I want to create a store with at least 20 animals. I don't think creating each variable is the correct way to go. Is there a better way to instantiate more animals and adding them to the animal_store without having to create them one at a time?
Aucun commentaire:
Enregistrer un commentaire