def clone_has_many(old_object, new_object)
      associations = old_object.class.reflect_on_all_associations(:has_many)
        .select{|a| !a.options.keys.include?(:through)}

      associations.each do |association|
        old_object.send(association.name).each do |old_association|
          new_object.send(association.name).build.tap do |new_association|
            assign_association(association, old_association, new_association)
          end
        end
      end

      new_object
    end
def clone_has_many(old_object, new_object)
      associations = old_object.class.reflect_on_all_associations(:has_many)
        .select{|a| !a.options.keys.include?(:through)}

      associations.each do |association|
        old_object.send(association.name).each do |old_association|
          new_object.send(association.name).build.tap do |new_association|
            assign_association(association, old_association, new_association)
          end
        end
      end

      new_object
    end
clone has_many associations