Browse files

key habtm fixtures off table name

  • Loading branch information...
1 parent 2b353ac commit 5b0695a8cba1f2f2dc88cb9777fc6e7bbe24da01 @tenderlove tenderlove committed Feb 11, 2011
Showing with 5 additions and 5 deletions.
  1. +5 −5 activerecord/lib/active_record/fixtures.rb
View
10 activerecord/lib/active_record/fixtures.rb
@@ -602,11 +602,11 @@ def insert_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 @@ def insert_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(

0 comments on commit 5b0695a

Please sign in to comment.