Sha256: e2fcc3ce591d4b69136d41a11f2659fd1463992e4951ee73910b542f3ea0cb2f

Contents?: true

Size: 482 Bytes

Versions: 52

Compression:

Stored size: 482 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Clone
      module InstanceMethods
        def initialize_copy(other)
          @_new       = true
          @_destroyed = false
          default_id_value({})
          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

52 entries across 52 versions & 3 rubygems

Version Path
mongo_mapper-unstable-2010.08.19 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.18 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.17 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.16 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.15 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.14 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.13 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.12 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.11 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.10 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.09 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-0.8.3 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.08 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.06 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.05 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.04 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.03 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.02 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.08.01 lib/mongo_mapper/plugins/clone.rb
mongo_mapper-unstable-2010.07.31 lib/mongo_mapper/plugins/clone.rb