lib/amoeba.rb in amoeba-1.2.1 vs lib/amoeba.rb in amoeba-2.0.0

- old
+ new

@@ -321,12 +321,12 @@ false end end # }}} - def dup(options={}) - @result = super() + def amoeba_dup(options={}) + @result = self.dup() # Inherit Parent Settings {{{ if !amoeba_conf.enabled && parent_amoeba_conf.inherit if amoeba_conf.upbringing parenting_style = amoeba_conf.upbringing @@ -420,11 +420,11 @@ end old_obj = self.send(relation_name) if not old_obj.nil? - copy_of_obj = old_obj.dup + copy_of_obj = old_obj.amoeba_dup copy_of_obj[:"#{settings.foreign_key}"] = nil @result.send(:"#{relation_name}=", copy_of_obj) end when :has_many @@ -437,11 +437,11 @@ # This is a M:M "has many through" where we # actually copy and reassociate the new children # rather than only maintaining the associations self.send(relation_name).each do |old_obj| - copy_of_obj = old_obj.dup + copy_of_obj = old_obj.amoeba_dup # associate this new child to the new parent object @result.send(relation_name) << copy_of_obj end else @@ -452,11 +452,11 @@ # association is really just for convenience usage # on the model return if settings.is_a?(ActiveRecord::Reflection::ThroughReflection) self.send(relation_name).each do |old_obj| - copy_of_obj = old_obj.dup + copy_of_obj = old_obj.amoeba_dup copy_of_obj[:"#{settings.foreign_key}"] = nil # associate this new child to the new parent object @result.send(relation_name) << copy_of_obj end @@ -465,10 +465,10 @@ when :has_and_belongs_to_many clone = amoeba_conf.clones.include?(relation_name) if clone self.send(relation_name).each do |old_obj| - copy_of_obj = old_obj.dup + copy_of_obj = old_obj.amoeba_dup # associate this new child to the new parent object @result.send(relation_name) << copy_of_obj end else