Forum: Ruby on Rails Using fixtures inside migrations

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Iván Vega R. (Guest)
on 2006-04-21 22:21
(Received via mailing list)

I want to add data from a fixture file to a table inside a migration.
I've saved the file in db/migrate/fixtures/countries.yml

I guess I could just open the file, read the entries, and add them to
the database using AR, but I'm hoping I can use Rails for all that.

Also, if I have a file, say, with 200,000+ records, what would be the
best method (performance-wise) to go about this? I was thinking
splitting the data on multiple files, each about 10,000 records or
so... what do you think?

I don't want to use SQL for this, to avoid problems between different

Thanks a lot!

Ivan V.
Iván Vega R. (Guest)
on 2006-04-22 00:49
(Received via mailing list)
I found this:

Do you think it would be better to use rake tasks for this? Or is the
migration better?
This topic is locked and can not be replied to.