From 38da0ace772e6f9f5e2fff74db76237ab31790fa Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Thu, 15 Apr 2010 12:02:26 +0200 Subject: Use primary key in conditions, not 'id' [#4395 state:resolved] Signed-off-by: Pratik Naik --- activerecord/lib/active_record/nested_attributes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/nested_attributes.rb b/activerecord/lib/active_record/nested_attributes.rb index 6718b4a69d..eb9e792dd8 100644 --- a/activerecord/lib/active_record/nested_attributes.rb +++ b/activerecord/lib/active_record/nested_attributes.rb @@ -355,7 +355,7 @@ module ActiveRecord association.to_a else attribute_ids = attributes_collection.map {|a| a['id'] || a[:id] }.compact - attribute_ids.present? ? association.all(:conditions => {:id => attribute_ids}) : [] + attribute_ids.present? ? association.all(:conditions => {association.primary_key => attribute_ids}) : [] end attributes_collection.each do |attributes| -- cgit v1.2.3