diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-07-21 11:04:21 -0300 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-07-21 17:17:23 +0200 |
commit | ef5ae60a07c7d45855a9a2a4b695f153ef9faa79 (patch) | |
tree | 271d9474489ec30eccaf5e8d9ab0d059e23d1195 /activerecord | |
parent | e107c208f0422b83df473666e30256f837c263eb (diff) | |
download | rails-ef5ae60a07c7d45855a9a2a4b695f153ef9faa79.tar.gz rails-ef5ae60a07c7d45855a9a2a4b695f153ef9faa79.tar.bz2 rails-ef5ae60a07c7d45855a9a2a4b695f153ef9faa79.zip |
Make use of tap to return a previously used var
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/association_collection.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 692badcc5c..f346a19a3a 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -397,10 +397,10 @@ module ActiveRecord @target = find_target.map do |f| i = @target.index(f) if i - t = @target.delete_at(i) - keys = ["id"] + t.changes.keys + (f.attribute_names - t.attribute_names) - t.attributes = f.attributes.except(*keys) - t + @target.delete_at(i).tap do |t| + keys = ["id"] + t.changes.keys + (f.attribute_names - t.attribute_names) + t.attributes = f.attributes.except(*keys) + end else f end |