Permalink
Browse files

Don't shadow attrs var

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9145 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 316906c commit fa6fcb45e200e19fdd9540ee7b60ce91524c4fe7 @jeremy jeremy committed Mar 30, 2008
Showing with 2 additions and 2 deletions.
  1. +2 −2 activeresource/lib/active_resource/base.rb
@@ -629,7 +629,7 @@ def initialize(attributes = {})
#
def clone
# Clone all attributes except the pk and any nested ARes
- attrs = self.attributes.reject {|k,v| k == self.class.primary_key || v.is_a?(ActiveResource::Base)}.inject({}) do |attrs, (k, v)|
+ cloned = attributes.reject {|k,v| k == self.class.primary_key || v.is_a?(ActiveResource::Base)}.inject({}) do |attrs, (k, v)|
attrs[k] = v.clone
attrs
end
@@ -638,7 +638,7 @@ def clone
# the raw objects to be cloned so we bypass load by directly setting the attributes hash.
resource = self.class.new({})
resource.prefix_options = self.prefix_options
- resource.send :instance_variable_set, '@attributes', attrs
+ resource.send :instance_variable_set, '@attributes', cloned
resource
end

0 comments on commit fa6fcb4

Please sign in to comment.