diff options
author | Emilio Tagua <miloops@gmail.com> | 2011-02-18 16:04:47 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2011-02-18 16:04:47 -0300 |
commit | 8052623a3d2092a8ac02a331df61b21163a71c65 (patch) | |
tree | 3240040f5448fd9926e18c6629661ec68a16eaad | |
parent | 49f3525f19a78b478367f997522197d03e8694ce (diff) | |
download | rails-8052623a3d2092a8ac02a331df61b21163a71c65.tar.gz rails-8052623a3d2092a8ac02a331df61b21163a71c65.tar.bz2 rails-8052623a3d2092a8ac02a331df61b21163a71c65.zip |
No need to have reinit_with inside an InstanceMethods module.
-rw-r--r-- | activerecord/lib/active_record/identity_map.rb | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb index 6718a92e13..d18b2b0a54 100644 --- a/activerecord/lib/active_record/identity_map.rb +++ b/activerecord/lib/active_record/identity_map.rb @@ -70,23 +70,21 @@ module ActiveRecord end end - module InstanceMethods - # Reinitialize an Identity Map model object from +coder+. - # +coder+ must contain the attributes necessary for initializing an empty - # model object. - def reinit_with(coder) - @attributes_cache = {} - dirty = @changed_attributes.keys - @attributes.update(coder['attributes'].except(*dirty)) - @changed_attributes.update(coder['attributes'].slice(*dirty)) - @changed_attributes.delete_if{|k,v| v.eql? @attributes[k]} - - set_serialized_attributes - - run_callbacks :find - - self - end + # Reinitialize an Identity Map model object from +coder+. + # +coder+ must contain the attributes necessary for initializing an empty + # model object. + def reinit_with(coder) + @attributes_cache = {} + dirty = @changed_attributes.keys + @attributes.update(coder['attributes'].except(*dirty)) + @changed_attributes.update(coder['attributes'].slice(*dirty)) + @changed_attributes.delete_if{|k,v| v.eql? @attributes[k]} + + set_serialized_attributes + + run_callbacks :find + + self end class Middleware |