diff options
author | Val Kotlarov Hoffman <val.hoffman@gmail.com> | 2013-08-30 13:29:20 +0300 |
---|---|---|
committer | Val Kotlarov Hoffman <val.hoffman@gmail.com> | 2013-08-30 13:29:20 +0300 |
commit | b9600001794eb1d4601f5774b592a068b73fd7b5 (patch) | |
tree | 85281ca1276d691a180908739d81ace3a324115d | |
parent | f90aa722fad2b33a95c85319070891d1eab352f5 (diff) | |
download | rails-b9600001794eb1d4601f5774b592a068b73fd7b5.tar.gz rails-b9600001794eb1d4601f5774b592a068b73fd7b5.tar.bz2 rails-b9600001794eb1d4601f5774b592a068b73fd7b5.zip |
FIX reload! within rails console --sandbox causes undefined method rollback upon exiting [https://github.com/rails/rails/issues/11834]
-rw-r--r-- | activerecord/lib/active_record/railties/console_sandbox.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/railties/console_sandbox.rb b/activerecord/lib/active_record/railties/console_sandbox.rb index 604a220303..1a04950898 100644 --- a/activerecord/lib/active_record/railties/console_sandbox.rb +++ b/activerecord/lib/active_record/railties/console_sandbox.rb @@ -1,5 +1,7 @@ ActiveRecord::Base.connection.begin_transaction(joinable: false) at_exit do - ActiveRecord::Base.connection.rollback_transaction + if ActiveRecord::Base.connection.transaction_open? + ActiveRecord::Base.connection.rollback_transaction + end end |