mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
No need to have reinit_with inside an InstanceMethods module.
This commit is contained in:
parent
49f3525f19
commit
8052623a3d
1 changed files with 12 additions and 14 deletions
|
@ -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]}
|
||||
# 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
|
||||
set_serialized_attributes
|
||||
|
||||
run_callbacks :find
|
||||
run_callbacks :find
|
||||
|
||||
self
|
||||
end
|
||||
self
|
||||
end
|
||||
|
||||
class Middleware
|
||||
|
|
Loading…
Reference in a new issue