basecamp / console1984

The Rails console you love, 1984 style
MIT License
634 stars 34 forks source link

Sandbox mode won't work with rails 7.2 #119

Open shouichi opened 2 months ago

shouichi commented 2 months ago

I recently upgraded our app (console1984 installed) to rails 7.2 and realized that the sandbox mode did not work. It worked fine when rails 7.1.

The problem seems like calling reconnect! without restore_transactions: true. I added the option and sandbox mode worked again. Furthermore, the sandbox mode breaks if I call ApplicationRecord.connection.reconnect! in a working sandboxed rails console.

https://github.com/basecamp/console1984/blob/f7b85df5866c16ff9ba0c4e3e994cb0d9e0106ab/lib/console1984/sessions_logger/database.rb#L64

See also https://github.com/basecamp/console1984/issues/91.

shouichi commented 2 months ago

I changed to use a different DB to store audit logs (followed https://github.com/basecamp/console1984/issues/91#issuecomment-2046247095) and everything works as expected.