Skip to content
This repository
Browse code

Use the correct table name from fixture

Fixed a bug in fixtures.rb where the table name was incorrectly inferred from the fixture path which was ambiguously called "table_name" but was also used as the fixture name.
Now, the "correct" table name is taken from an instance variable.
  • Loading branch information...
commit 64f106dfd1bcff13882ef2be44585f68c6cb9950 1 parent ae8bb11
Alexey Muranov authored December 27, 2011
4  activerecord/lib/active_record/fixtures.rb
@@ -486,8 +486,8 @@ def self.create_fixtures(fixtures_directory, table_names, class_names = {})
486 486
 
487 487
             # Cap primary key sequences to max(pk).
488 488
             if connection.respond_to?(:reset_pk_sequence!)
489  
-              table_names.each do |table_name|
490  
-                connection.reset_pk_sequence!(table_name.tr('/', '_'))
  489
+              fixture_files.each do |ff|
  490
+                connection.reset_pk_sequence!(ff.table_name)
491 491
               end
492 492
             end
493 493
           end

0 notes on commit 64f106d

Please sign in to comment.
Something went wrong with that request. Please try again.