instance method insert!

Ruby on Rails 6.0.6

Since v6.0.6 Last seen in v7.1.6

Available in: v6.0.6 v6.1.7.10 v7.0.10 v7.1.6

Signature

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

attributes req
returning key = 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

Type at least 2 characters to search.

↑↓ navigate · open · esc close