Skip to content

Commit be52f1b

Browse files
committed
Use 1.9 way
1 parent 5e1cfb0 commit be52f1b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

Diff for: activerecord/lib/active_record/associations/collection_association.rb

+1-6
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,7 @@ def merge_target_lists(persisted, memory)
400400
return memory if persisted.empty?
401401

402402
persisted.map! do |record|
403-
# Unfortunately we cannot simply do memory.delete(record) since on 1.8 this returns
404-
# record rather than memory.at(memory.index(record)). The behavior is fixed in 1.9.
405-
mem_index = memory.index(record)
406-
407-
if mem_index
408-
mem_record = memory.delete_at(mem_index)
403+
if mem_record = memory.delete(record)
409404

410405
(record.attribute_names - mem_record.changes.keys).each do |name|
411406
mem_record[name] = record[name]

0 commit comments

Comments
 (0)