instance method restore_transaction_record_state

Ruby on Rails 3.0.20

Since v3.0.20 Last seen in v3.1.12

Available in: v3.0.20 v3.1.12

Signature

restore_transaction_record_state(force = false)

Restore the new record state and id of a record that was previously saved by a call to save_record_state.

Parameters

force opt = false
Source
# File activerecord/lib/active_record/transactions.rb, line 322
    def restore_transaction_record_state(force = false) #:nodoc
      if defined?(@_start_transaction_state)
        @_start_transaction_state[:level] = (@_start_transaction_state[:level] || 0) - 1
        if @_start_transaction_state[:level] < 1
          restore_state = remove_instance_variable(:@_start_transaction_state)
          if restore_state
            @attributes = @attributes.dup if @attributes.frozen?
            @new_record = restore_state[:new_record]
            @destroyed = restore_state[:destroyed]
            if restore_state[:id]
              self.id = restore_state[:id]
            else
              @attributes.delete(self.class.primary_key)
              @attributes_cache.delete(self.class.primary_key)
            end
          end
        end
      end
    end

Defined in activerecord/lib/active_record/transactions.rb line 322 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Transactions

Type at least 2 characters to search.

↑↓ navigate · open · esc close