From 5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 11 Feb 2011 17:53:55 -0800 Subject: key habtm fixtures off table name --- activerecord/lib/active_record/fixtures.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 413e0b3088..4459b711e6 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -602,11 +602,11 @@ class Fixtures fixtures.delete('DEFAULTS') # track any join tables we need to insert later - habtm_fixtures = Hash.new do |h, habtm| - h[habtm] = HabtmFixtures.new( + habtm_fixtures = Hash.new do |h, path| + h[path] = HabtmFixtures.new( @connection, - habtm.options[:join_table], - Fixtures.find_table_name(habtm.options[:join_table]), nil) + path, + Fixtures.find_table_name(path), nil) end rows = fixtures.map do |label, fixture| @@ -655,7 +655,7 @@ class Fixtures when :has_and_belongs_to_many if (targets = row.delete(association.name.to_s)) targets = targets.is_a?(Array) ? targets : targets.split(/\s*,\s*/) - join_fixtures = habtm_fixtures[association] + join_fixtures = habtm_fixtures[association.options[:join_table]] targets.each do |target| join_fixtures["#{label}_#{target}"] = Fixture.new( -- cgit v1.2.3