method

rollback_records

Importance_0
v7.0.0 - Show latest stable - 0 notes - Class: Transaction
rollback_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 126
      def rollback_records
        return unless records
        ite = records.uniq(&:__id__)
        already_run_callbacks = {}
        while record = ite.shift
          trigger_callbacks = record.trigger_transactional_callbacks?
          should_run_callbacks = !already_run_callbacks[record] && trigger_callbacks
          already_run_callbacks[record] ||= trigger_callbacks
          record.rolledback!(force_restore_state: full_rollback?, should_run_callbacks: should_run_callbacks)
        end
      ensure
        ite&.each do |i|
          i.rolledback!(force_restore_state: full_rollback?, should_run_callbacks: false)
        end
      end
Register or log in to add new notes.