public
Description: Koz's rails git-svn clone
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/NZKoz/koz-rails.git
Don't shadow attrs var


git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9145 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
bitsweat (author)
Sat Mar 29 23:17:29 -0700 2008
commit  e3dd91f8067d0e66d18b50175d109b54018c5604
tree    60a64628e1d535da726977cc69d107cca00d507b
parent  12af1cf8b9335832518b38ea7875502e9c3bfc7d
...
629
630
631
632
 
633
634
635
...
638
639
640
641
 
642
643
644
...
629
630
631
 
632
633
634
635
...
638
639
640
 
641
642
643
644
0
@@ -629,7 +629,7 @@ module ActiveResource
0
     #
0
     def clone
0
       # Clone all attributes except the pk and any nested ARes
0
- attrs = self.attributes.reject {|k,v| k == self.class.primary_key || v.is_a?(ActiveResource::Base)}.inject({}) do |attrs, (k, v)|
0
+ cloned = attributes.reject {|k,v| k == self.class.primary_key || v.is_a?(ActiveResource::Base)}.inject({}) do |attrs, (k, v)|
0
         attrs[k] = v.clone
0
         attrs
0
       end
0
@@ -638,7 +638,7 @@ module ActiveResource
0
       # the raw objects to be cloned so we bypass load by directly setting the attributes hash.
0
       resource = self.class.new({})
0
       resource.prefix_options = self.prefix_options
0
- resource.send :instance_variable_set, '@attributes', attrs
0
+ resource.send :instance_variable_set, '@attributes', cloned
0
       resource
0
     end
0
 

Comments

    No one has commented yet.