def with_transaction_returning_status
      status = nil
      self.class.transaction do
        if has_transactional_callbacks?
          add_to_transaction
        else
          sync_with_transaction_state if @transaction_state&.finalized?
          @transaction_state = self.class.connection.transaction_state
        end
        remember_transaction_record_state

        status = yield
        raise ActiveRecord::Rollback unless status
      end
      status
    end
def with_transaction_returning_status
      status = nil
      self.class.transaction do
        if has_transactional_callbacks?
          add_to_transaction
        else
          sync_with_transaction_state if @transaction_state&.finalized?
          @transaction_state = self.class.connection.transaction_state
        end
        remember_transaction_record_state

        status = yield
        raise ActiveRecord::Rollback unless status
      end
      status
    end
Executes +method+ within a transaction and captures its return value as a
 status flag. If the status is true the transaction is committed, otherwise
 a ROLLBACK is issued. In any case the status flag is returned.

 This method is available within the context of an ActiveRecord::Base
 instance.