aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-10-30 22:04:19 +0900
committerGitHub <noreply@github.com>2018-10-30 22:04:19 +0900
commit9ae3ddbb21ece10550c8fd37e0c12bab9f5a89f8 (patch)
treea42e2a5bf7807729aeeb7822fa89152dcb8115af /activerecord/lib
parent6889e720ccd264ddcf47162742c347a4559a9129 (diff)
parentcf1d75d95d06ce3ac9e3ab7f19ecc17b49530942 (diff)
downloadrails-9ae3ddbb21ece10550c8fd37e0c12bab9f5a89f8.tar.gz
rails-9ae3ddbb21ece10550c8fd37e0c12bab9f5a89f8.tar.bz2
rails-9ae3ddbb21ece10550c8fd37e0c12bab9f5a89f8.zip
Merge pull request #19388 from yakara-ltd/fix-habtm-fixture-order
Avoid violating key constraints in fixture HABTM associations
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/fixture_set/table_rows.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/fixture_set/table_rows.rb b/activerecord/lib/active_record/fixture_set/table_rows.rb
index e8335a2e10..3e3c0bc7ab 100644
--- a/activerecord/lib/active_record/fixture_set/table_rows.rb
+++ b/activerecord/lib/active_record/fixture_set/table_rows.rb
@@ -45,6 +45,9 @@ module ActiveRecord
# track any join tables we need to insert later
@tables = Hash.new { |h, table| h[table] = [] }
+ # ensure this table is loaded before any HABTM associations
+ @tables[table_name] = nil
+
build_table_rows_from(fixtures, config)
end