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? On 4/21/06, Iv?n Vega Rivera <ivanvega@gmail.com> wrote:> 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. >
Seemingly Similar Threads
- Stories with many tags, tags with many stories, has_and_belongs_to_many howto?
- Using :include "recursively" (including the children of the child)?
- "Selecting" a calculated row / Using :select in the paginate method
- Creating a model that acts as a settings manager
- Help with SCGI please :(