For example, my app comes with a rake task called db:bootstrap with
populates my data base with all the default data it needs to start,
e.g. default admin, etc…
Well, we’re only talking about 100 rows (10 in one table 90 in
another) that won’t change.
I was just going to put
obj = Object.create(:attr => ‘blah’)
in a migration file…
It is only happening once, so speed is not a huge issue.
That should work fine if speed is not an issue. You could also put it in
a separate ruby scrip and use script/runner to load them. This would
allow you a little more flexibility as you could delete and reload data
without having to migrate the database back and forth each time.
One thing you can do to dramatically increase speed in the script runner
approach is to wrap all of the inserts in on transaction rather than
each having it’s own.
Object.transaction do
Object.create(:attr => ‘blah’)
end
phil wrote:
the table in?
–
Sincerely,
William P.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.