instance method
insert!
Ruby on Rails 6.0.6
Since v6.0.6 Last seen in v7.1.6Signature
insert!(attributes, returning: 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 ActiveRecord::Persistence#insert_all! for more.
Parameters
-
attributesreq -
returningkey = nil
Source
# File activerecord/lib/active_record/persistence.rb, line 133
def insert!(attributes, returning: nil)
insert_all!([ attributes ], returning: returning)
end
Defined in activerecord/lib/active_record/persistence.rb line 133
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Persistence::ClassMethods