def initialize_dup(other)
        cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
        self.class.initialize_attributes(cloned_attributes, :serialized => false)

        cloned_attributes.delete(self.class.primary_key)

        @attributes = cloned_attributes

        _run_after_initialize_callbacks if respond_to?(:_run_after_initialize_callbacks)

        @changed_attributes = {}
        self.class.column_defaults.each do |attr, orig_value|
          @changed_attributes[attr] = orig_value if _field_changed?(attr, orig_value, @attributes[attr])
        end

        @aggregation_cache = {}
        @association_cache = {}
        @attributes_cache = {}
        @new_record  = true

        ensure_proper_type
        populate_with_current_scope_attributes
        super
      end
def initialize_dup(other)
        cloned_attributes = other.clone_attributes(:read_attribute_before_type_cast)
        self.class.initialize_attributes(cloned_attributes, :serialized => false)

        cloned_attributes.delete(self.class.primary_key)

        @attributes = cloned_attributes

        _run_after_initialize_callbacks if respond_to?(:_run_after_initialize_callbacks)

        @changed_attributes = {}
        self.class.column_defaults.each do |attr, orig_value|
          @changed_attributes[attr] = orig_value if _field_changed?(attr, orig_value, @attributes[attr])
        end

        @aggregation_cache = {}
        @association_cache = {}
        @attributes_cache = {}
        @new_record  = true

        ensure_proper_type
        populate_with_current_scope_attributes
        super
      end
Duped objects have no id assigned and are treated as new records. Note
 that this is a "shallow" copy as it copies the object's attributes
 only, not its associations. The extent of a "deep" copy is application
 specific and is therefore left to the application to implement according
 to its need.
 The dup method does not preserve the timestamps (created|updated)_(at|on).