Using fixtures inside migrations

Hi,

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
databases.

Thanks a lot!

Ivan V.

I found this: http://textsnippets.com/posts/show/320

Do you think it would be better to use rake tasks for this? Or is the
migration better?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs