Forum: Ruby on Rails Using fixtures inside migrations

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C5380b957ff8ce5cb14cf2282ffeb720?d=identicon&s=25 Iván Vega Rivera (Guest)
on 2006-04-21 20:21
(Received via mailing list)
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.
C5380b957ff8ce5cb14cf2282ffeb720?d=identicon&s=25 Iván Vega Rivera (Guest)
on 2006-04-21 22:49
(Received via mailing list)
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 topic is locked and can not be replied to.