how to insert a batch of records into db more efficiently

I would not say this is the best style (pretty ugly in fact), but for bulk inserts I have gotten much better performance using a raw SQL insert.

You can get the connection to the DB using the 'connection' method on an AR class. Then there are methods to execute raw SQL commands documented under "database statements" module at ActiveRecord::ConnectionAdapters::DatabaseStatements.

Using this you can insert multiple rows, or just avoid the AR overhead for creating and dealing with objects.