aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-03 12:04:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-03 12:04:57 +0000
commit4f6c943b05ea537be515ae6d70f8986191ef7e30 (patch)
tree5b64e2200fe00ca09f3fad9169b5d5ced5d73b62 /activerecord
parent430ca4d04ffa64c32db78e358f4cd8ebaba06443 (diff)
downloadrails-4f6c943b05ea537be515ae6d70f8986191ef7e30.tar.gz
rails-4f6c943b05ea537be515ae6d70f8986191ef7e30.tar.bz2
rails-4f6c943b05ea537be515ae6d70f8986191ef7e30.zip
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
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb2
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