```ruby
ActiveRecord::Base.connection.begin_transaction(joinable: false)

at_exit do
  ActiveRecord::Base.connection.rollback_transaction
end
```

FIX reload! within rails console --sandbox causes undefined method rollback upon exiting
user
```ruby
ActiveRecord::Base.connection.begin_transaction(joinable: false)

at_exit do
  if ActiveRecord::Base.connection.transaction_open?
    ActiveRecord::Base.connection.rollback_transaction
  end
end
```
assistant