Sha256: f3bb4dd9d73d593f36253c25de274665046e77220988c59d19e9ab8f42a2c29e
Contents?: true
Size: 573 Bytes
Versions: 6
Compression:
Stored size: 573 Bytes
Contents
# encoding: UTF-8 module MongoMapper module Plugins module Clone extend ActiveSupport::Concern def initialize_copy(other) @_new = true @_destroyed = false @_id = nil 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
6 entries across 6 versions & 3 rubygems