@@ -16121,39 +16121,6 @@ module ActiveRecord
1612116121 extend ActiveSupport::Concern
1612216122
1612316123 module ClassMethods
16124- # Creates an object (or multiple objects) and saves it to the database, if validations pass.
16125- # The resulting object is returned whether the object was saved successfully to the database or not.
16126- #
16127- # The +attributes+ parameter can be either a Hash or an Array of Hashes. These Hashes describe the
16128- # attributes on the objects that are to be created.
16129- #
16130- # ==== Examples
16131- # # Create a single new object
16132- # User.create(first_name: 'Jamie')
16133- #
16134- # # Create an Array of new objects
16135- # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }])
16136- #
16137- # # Create a single object and pass it into a block to set other attributes.
16138- # User.create(first_name: 'Jamie') do |u|
16139- # u.is_admin = false
16140- # end
16141- #
16142- # # Creating an Array of new objects using a block, where the block is executed for each object:
16143- # User.create([{ first_name: 'Jamie' }, { first_name: 'Jeremy' }]) do |u|
16144- # u.is_admin = false
16145- # end
16146- def create: (?untyped? attributes) ?{ () -> untyped } -> untyped
16147-
16148- # Creates an object (or multiple objects) and saves it to the database,
16149- # if validations pass. Raises a RecordInvalid error if validations fail,
16150- # unlike Base#create.
16151- #
16152- # The +attributes+ parameter can be either a Hash or an Array of Hashes.
16153- # These describe which attributes to be created on the object, or
16154- # multiple objects when given an Array of Hashes.
16155- def create!: (?untyped? attributes) ?{ () -> untyped } -> untyped
16156-
1615716124 # Given an attributes hash, +instantiate+ returns a new instance of
1615816125 # the appropriate class. Accepts only keys as strings.
1615916126 #
0 commit comments