Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Only include associations when the relevant rows have content

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1079 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 4f6c943b05ea537be515ae6d70f8986191ef7e30 1 parent 430ca4d
@dhh dhh authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  activerecord/lib/active_record/associations.rb
View
2  activerecord/lib/active_record/associations.rb
@@ -652,7 +652,7 @@ def construct_finder_sql_with_included_associations(reflections)
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
Please sign in to comment.
Something went wrong with that request. Please try again.