1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Don't shadow attrs var

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9145 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper 2008-03-30 06:17:29 +00:00
parent 316906cbbb
commit fa6fcb45e2

View file

@ -629,7 +629,7 @@ module ActiveResource
#
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 @@ module ActiveResource
# 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