diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-11 17:53:55 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-11 17:53:55 -0800 |
commit | 5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01 (patch) | |
tree | 565b3a034c375fe95036626ea059fa38db3c8999 /activerecord/lib | |
parent | 2b353acac319fdba5bd1dafda5f13ea7a62666aa (diff) | |
download | rails-5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01.tar.gz rails-5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01.tar.bz2 rails-5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01.zip |
key habtm fixtures off table name
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 10 |
1 files changed, 5 insertions, 5 deletions
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( |