mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Open transaction for multi-db apps
With a multiple database application `rails console --sandbox` becomes problematic. We can't rollback any modifications for every database because we can't open transaction for the connections that haven't not yet been loaded. To solve this I handled that if the database is connected then it will open transaction.
This commit is contained in:
parent
257f151ffd
commit
67517fde49
1 changed files with 2 additions and 4 deletions
|
@ -1,7 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
ActiveRecord::Base.connection.begin_transaction(joinable: false)
|
||||
|
||||
at_exit do
|
||||
ActiveRecord::Base.connection.rollback_transaction
|
||||
ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :after) do
|
||||
begin_transaction(joinable: false)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue