diff options
author | Mathieu Arnold <m@absolight.fr> | 2010-04-15 12:02:26 +0200 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-05-04 22:45:08 +0100 |
commit | 38da0ace772e6f9f5e2fff74db76237ab31790fa (patch) | |
tree | d5a54fa86a707d67c37f686d60a21ccb7ae6f0af /activerecord/lib | |
parent | bce2c0ce37cbd4abb45ca36362fbb8fae3bbc6b9 (diff) | |
download | rails-38da0ace772e6f9f5e2fff74db76237ab31790fa.tar.gz rails-38da0ace772e6f9f5e2fff74db76237ab31790fa.tar.bz2 rails-38da0ace772e6f9f5e2fff74db76237ab31790fa.zip |
Use primary key in conditions, not 'id' [#4395 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/nested_attributes.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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| |