diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index fa3c28f7d4..ba6a0ab89b 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -652,7 +652,7 @@ module ActiveRecord def extract_association_for_record(record, rows, reflection) association = rows.collect do |row| - if row["#{table_name}__#{primary_key}"] == record.id.to_s + if row["#{table_name}__#{primary_key}"] == record.id.to_s && !row["#{reflection.klass.table_name}__#{reflection.klass.primary_key}"].nil? reflection.klass.send(:instantiate, extract_record(reflection.klass.table_name, row)) end end |