Batch insertion in rails 3
I want to do a batch insert of few thousand records into the database (POSTGRES in my case) from within my Rails App. What would be the "Rails way" of doing it? Something which is fast and also correct way of doing it. I know I can create the SQL query by string concatenation of the attributes but I want a better approach. ActiveRecord .create method supports bulk creation. The method emulates the feature if the DB doesn't support it and uses the underlying DB engine if the feature is supported. Just pass an array of options. # Create an Array of new objects User.create([{ :first_name =>