method

commit_records

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: Transaction
commit_records() public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract/transaction.rb, line 228
      def commit_records
        return unless records

        ite = unique_records

        if @run_commit_callbacks
          instances_to_run_callbacks_on = prepare_instances_to_run_callbacks_on(ite)

          run_action_on_records(ite, instances_to_run_callbacks_on) do |record, should_run_callbacks|
            record.committed!(should_run_callbacks: should_run_callbacks)
          end
        else
          while record = ite.shift
            # if not running callbacks, only adds the record to the parent transaction
            connection.add_transaction_record(record)
          end
        end
      ensure
        ite&.each { |i| i.committed!(should_run_callbacks: false) }
      end
Register or log in to add new notes.