aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJulia Lopez <julia@getharvest.com>2016-12-14 12:14:47 +0100
committerJulia Lopez <julia@getharvest.com>2016-12-21 11:09:29 +0100
commit5e46f4ccb477dcb0ecce3242f20c59e9c890964d (patch)
tree41197bd9ae640b736cec312b5c0bc78dadbb48f1 /activerecord/lib
parent0dc9eb46ee47b1196583fd860b25242b6421ab1e (diff)
downloadrails-5e46f4ccb477dcb0ecce3242f20c59e9c890964d.tar.gz
rails-5e46f4ccb477dcb0ecce3242f20c59e9c890964d.tar.bz2
rails-5e46f4ccb477dcb0ecce3242f20c59e9c890964d.zip
fix #create_fixtures when equal table names in different databases
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/fixtures.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb
index 21c5e5b5bb..3b4532a3f2 100644
--- a/activerecord/lib/active_record/fixtures.rb
+++ b/activerecord/lib/active_record/fixtures.rb
@@ -536,16 +536,16 @@ module ActiveRecord
update_all_loaded_fixtures fixtures_map
connection.transaction(requires_new: true) do
- deleted_tables = Set.new
+ deleted_tables = Hash.new { |h, k| h[k] = Set.new }
fixture_sets.each do |fs|
conn = fs.model_class.respond_to?(:connection) ? fs.model_class.connection : connection
table_rows = fs.table_rows
table_rows.each_key do |table|
- unless deleted_tables.include? table
+ unless deleted_tables[conn].include? table
conn.delete "DELETE FROM #{conn.quote_table_name(table)}", "Fixture Delete"
end
- deleted_tables << table
+ deleted_tables[conn] << table
end
table_rows.each do |fixture_set_name, rows|