ActiveRecord batch insert for MySQL

Hi guys,

I am a pretty new developer for RoR, and I am wondering whether batch
inserts for ActiveRecord are available. I know that
ActiveRecord::Base::create accepts an array of hashes, but from the
MySQL logs, I can see that the inserts are not batched.

Would like to stay within the ActiveRecord framework, if possible.
Thanks in advance for comments and suggestions.

v

I am a pretty new developer for RoR, and I am wondering whether batch
inserts for ActiveRecord are available. I know that
ActiveRecord::Base::create accepts an array of hashes, but from the
MySQL logs, I can see that the inserts are not batched.

Would like to stay within the ActiveRecord framework, if possible.
Thanks in advance for comments and suggestions.

Check out:
http://api.rubyonrails.com/classes/ActiveRecord/Transactions/ClassMethods.html

I think that’ll get you close but I didn’t read the page super closely.

The other way would be to create a query string and just submit that
via the connection_adaptor directly rather than relying on rails to
figure it out. Requires some knowledge of SQL but I’m betting you can
hack it together :slight_smile:

Cheers,
Chuck V.