module TorqueBox::Transactions::ActiveRecordAdapters::Transaction

Public Instance Methods

commit() click to toggle source
Calls superclass method
# File lib/torquebox/active_record_adapters.rb, line 87
def commit
  raise ActiveRecord::Rollback if @rolled_back
  super
  @complete = true
  connections.each { |connection| connection.commit_transaction_records }
end
connections() click to toggle source
# File lib/torquebox/active_record_adapters.rb, line 115
def connections
  @connections ||= Set.new
end
error( exception ) click to toggle source
Calls superclass method
# File lib/torquebox/active_record_adapters.rb, line 82
def error( exception )
  super
rescue ActiveRecord::Rollback
end
prepare() click to toggle source
Calls superclass method
# File lib/torquebox/active_record_adapters.rb, line 75
def prepare
  super
  # TODO: not this, but we need AR's pooled connection to
  # refresh from jboss *after* the transaction is begun.
  ActiveRecord::Base.clear_active_connections!
end
rollback() click to toggle source
Calls superclass method
# File lib/torquebox/active_record_adapters.rb, line 94
def rollback
  super
  @complete = true
  connections.each do |connection| 
    connection.rollback_transaction_records(@transactions.empty?) 
  end
end
should_commit?(connection) click to toggle source
# File lib/torquebox/active_record_adapters.rb, line 102
def should_commit?(connection)
  return true if @complete || !active?
  connections << connection
  false
end
should_rollback?(connection) click to toggle source
# File lib/torquebox/active_record_adapters.rb, line 108
def should_rollback?(connection)
  return true if @complete || !active?
  connections << connection
  @rolled_back = true
  false
end