diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-11 17:20:53 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-02-11 17:20:53 -0800 |
commit | bc3c3453d485a098c91d96b6f0a8e2c9a1e9b17b (patch) | |
tree | c8700da1885a3724bf4f3f28a299e00d6dec0843 /activerecord | |
parent | 55a4fb5e705671058ffe6d9af965742d560c31e5 (diff) | |
download | rails-bc3c3453d485a098c91d96b6f0a8e2c9a1e9b17b.tar.gz rails-bc3c3453d485a098c91d96b6f0a8e2c9a1e9b17b.tar.bz2 rails-bc3c3453d485a098c91d96b6f0a8e2c9a1e9b17b.zip |
convert fixtures to a list of hashes to insert
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/fixtures.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/fixtures.rb b/activerecord/lib/active_record/fixtures.rb index 6eeb012aa1..546c49b3c3 100644 --- a/activerecord/lib/active_record/fixtures.rb +++ b/activerecord/lib/active_record/fixtures.rb @@ -609,7 +609,7 @@ class Fixtures Fixtures.find_table_name(habtm.options[:join_table]), nil) end - fixtures.each do |label, fixture| + rows = fixtures.map do |label, fixture| row = fixture.to_hash if model_class && model_class < ActiveRecord::Base @@ -668,7 +668,11 @@ class Fixtures end end - @connection.insert_fixture(fixture, @table_name) + row + end + + rows.each do |row| + @connection.insert_fixture(row, table_name) end # insert any HABTM join tables we discovered |