Forum: Ruby on Rails inserting many records into a database

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.
C50ef69869149a93d6487a7ab191f208?d=identicon&s=25 Sandworth Meb (farmerss)
on 2008-12-08 13:16

I want to insert many records into a database. If I do them one-by-one,
it takes a long time. Does Rails have a method to optimize this --
creating a single SQL command for many records, maybe? The entries I
want to enter are all children to a single parent. Creating an array
children_array of the child objects is fast; it's when I do

children_array.each do |child|

that it takes a long time. (Here children is the name of the table that
has child objects.)

- Farmer
B14575f0ca69f10938fdd67e7156e0e1?d=identicon&s=25 Craig Demyanovich (Guest)
on 2008-12-08 15:17
(Received via mailing list)
You might be able to use ar-extensions [] [] from my friend and
colleague, Zach Dennis.

C50ef69869149a93d6487a7ab191f208?d=identicon&s=25 Sandworth Meb (farmerss)
on 2008-12-10 02:12
Thanks a lot! That looks really useful.
This topic is locked and can not be replied to.