aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-02 14:27:47 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2013-05-02 14:27:47 -0700
commitefaecadaf9cc2f3b55df04f3355dbc298a544a46 (patch)
tree6df08504441fe39b15c773ef3795810a051b562c /activerecord/lib
parent09751fdc847c25237891a8fcb0c2312e39bbe86d (diff)
parent56445c9075e22fdf00b534363c0744c78d6037f0 (diff)
downloadrails-efaecadaf9cc2f3b55df04f3355dbc298a544a46.tar.gz
rails-efaecadaf9cc2f3b55df04f3355dbc298a544a46.tar.bz2
rails-efaecadaf9cc2f3b55df04f3355dbc298a544a46.zip
Merge pull request #10424 from markevich/fix_test_prepare
Restore ActiveRecord connection to original environment after rake:db:test:prepare task.
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/railties/databases.rake10
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/railties/databases.rake b/activerecord/lib/active_record/railties/databases.rake
index 92bef09ff5..434af3c5f8 100644
--- a/activerecord/lib/active_record/railties/databases.rake
+++ b/activerecord/lib/active_record/railties/databases.rake
@@ -319,9 +319,13 @@ db_namespace = namespace :db do
# desc "Recreate the test database from an existent schema.rb file"
task :load_schema => 'db:test:purge' do
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
- ActiveRecord::Schema.verbose = false
- db_namespace["schema:load"].invoke
+ begin
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
+ ActiveRecord::Schema.verbose = false
+ db_namespace["schema:load"].invoke
+ ensure
+ ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations[Rails.env])
+ end
end
# desc "Recreate the test database from an existent structure.sql file"