Sha256: b8dbd24a6fadb52edde5fc4c7dd8c95f45f69f025f09a212113e78409777671e
Contents?: true
Size: 644 Bytes
Versions: 15
Compression:
Stored size: 644 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Clone extend ActiveSupport::Concern def initialize_copy(other) @_new = true @_destroyed = false remove_instance_variable :@_id if instance_variable_defined?(:@_id) init_ivars 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
Version data entries
15 entries across 15 versions & 1 rubygems