Sha256: 57899606ecdc6f2126034f29879319ae35d1add9f8327f2eb80ba194cc43b96b
Contents?: true
Size: 600 Bytes
Versions: 2
Compression:
Stored size: 600 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Clone module InstanceMethods def initialize_copy(other) @_new = true @_destroyed = false default_id_value associations.each do |name, association| instance_variable_set(association.ivar, nil) end self.attributes = other.attributes.clone.except(:_id).inject({}) do |hash, entry| key, value = entry hash[key] = value.duplicable? ? value.clone : value hash end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ign-mongo_mapper-0.8.6.2 | lib/mongo_mapper/plugins/clone.rb |
ign-mongo_mapper-0.8.6.1 | lib/mongo_mapper/plugins/clone.rb |