Inserting many records into a database


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

You might be able to use ar-extensions [] [] from my friend and
colleague, Zach D…


Thanks a lot! That looks really useful.

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