Sha256: 6f9c7ff89cea38e504d2cfbe2a823e089185dce0ccea9dec9a220a98e7959b29

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

require "mongoid/cloneable/version"
require "mongoid"
require "active_support/concern"
require "active_support/core_ext"

module Mongoid
  module Cloneable
    extend ActiveSupport::Concern

    autoload :DocumentCloner, 'mongoid/cloneable/document_cloner'
    autoload :RelationshipCloner, 'mongoid/cloneable/relationship_cloner'

    module ClassMethods
      def cloneable(options=nil)
        @cloneable = options if options
        @cloneable
      end
    end

    def clone
      super.tap do |cloned_document|
        DocumentCloner.new(self, cloned_document)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoid_cloneable-0.0.1 lib/mongoid_cloneable.rb