diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-27 00:11:21 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-11-27 00:19:26 -0200 |
commit | 462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1 (patch) | |
tree | da0f0061462ddead1684a3d98190cc52bc17cab8 /activerecord | |
parent | 8df46eac766ecdb1baadeddf3b93eacc6386c086 (diff) | |
download | rails-462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1.tar.gz rails-462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1.tar.bz2 rails-462a90565cd9bdecbaaf0b9d9b1ff2f66bebb8f1.zip |
Remove useless check of AR being defined from teardown fixtures
We are already in the AR namespace, there's no way for it to be
undefined. See the cousin commit 13e72db77063f57c3028a906690d42fb068845bb
Refactor a bit teardown fixtures to avoid two conditionals.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 7922bbcfa0..c5ad14722e 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -872,11 +872,7 @@ module ActiveRecord end def teardown_fixtures - return unless defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank? - - unless run_in_transaction? - ActiveRecord::FixtureSet.reset_cache - end + return if ActiveRecord::Base.configurations.blank? # Rollback changes if a transaction is active. if run_in_transaction? @@ -884,7 +880,10 @@ module ActiveRecord connection.rollback_transaction if connection.transaction_open? end @fixture_connections.clear + else + ActiveRecord::FixtureSet.reset_cache end + ActiveRecord::Base.clear_active_connections! end |