Patch composite_primary_keys to work around issue when one component of
authorTom Hughes <tom@compton.nu>
Fri, 8 May 2009 17:56:12 +0000 (17:56 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 8 May 2009 17:56:12 +0000 (17:56 +0000)
a composite key is called "id".

vendor/gems/composite_primary_keys-2.2.2/lib/composite_primary_keys/association_preload.rb

index 00b343c4e0633e490485f198e488d2f59771b7d0..56b2b9c73302b6de9e3b59d51ee0a257bf2a7d8b 100644 (file)
@@ -114,7 +114,7 @@ module CompositePrimaryKeys
             id_map = {}
 
             records.each do |record|
-              key = primary_key_name.map{|k| record.send(k)}
+              key = primary_key_name.map{|k| record.attributes[k]}
               key_as_string = key.join(CompositePrimaryKeys::ID_SEP)
 
               if key_as_string