instance method
insert!
Ruby on Rails edge
Since v7.2.3.2Signature
insert!(attributes, returning: nil, unique_by: nil, record_timestamps: nil)
Inserts a single record into the database in a single SQL INSERT statement. It does not instantiate any models nor does it trigger Active Record callbacks or validations. Though passed values go through Active Record’s type casting and serialization.
See #insert_all! for more.
Parameters
-
attributesreq -
returningkey = nil -
unique_bykey = nil -
record_timestampskey = nil
Source
# File activerecord/lib/active_record/relation.rb, line 784
def insert!(attributes, returning: nil, unique_by: nil, record_timestamps: nil)
insert_all!([ attributes ], returning: returning, unique_by: unique_by, record_timestamps: record_timestamps)
end
Defined in activerecord/lib/active_record/relation.rb line 784
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Relation