Sha256: 9fbd95fbbd278119c8bf99226c165a3d4294d1f3cbd448c9119316f72ff048d7
Contents?: true
Size: 637 Bytes
Versions: 3
Compression:
Stored size: 637 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Clone extend ActiveSupport::Concern 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongo_mapper-0.9.2 | lib/mongo_mapper/plugins/clone.rb |
mongo_mapper-0.9.1 | lib/mongo_mapper/plugins/clone.rb |
mongo_mapper-0.9.0 | lib/mongo_mapper/plugins/clone.rb |