Created
September 2, 2013 20:22
-
-
Save the-undefined/6416940 to your computer and use it in GitHub Desktop.
Multiple record attribute hashes handed to an ActiveRecord model create method uses multiple SQL Insert statements, disappointingly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Item.create(name: 'one record, one query') # One SQL Insert Query | |
multiple_items = [{ name: 'record one'}, { name: 'record two' }] | |
Item.create(multiple_items) # Two Consecutive SQL Insert Queries |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment