<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1,5 @@
+v0.1.2. ensure id_names are unique
+
+v0.1.1. updated to use Soup 0.2.1
+
 v0.1.0. initial release</diff>
      <filename>CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -12,7 +12,7 @@ begin
     m.rubyforge_name = &quot;pottery&quot;
     m.rdoc_options &lt;&lt; '--inline-source'
     m.rdoc_pattern = [&quot;README&quot;, &quot;CHANGELOG&quot;, &quot;LICENSE&quot;]
-    m.dependencies = [&quot;soup &gt;=0.2.1&quot;, &quot;morph &gt;=0.1.5&quot;]
+    m.dependencies = [&quot;soup =0.2.1&quot;, &quot;morph &gt;=0.1.5&quot;]
   end
 
 rescue LoadError</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@ require 'morph'
 require 'soup'
 
 module Pottery
-  VERSION = &quot;0.1.1&quot;
+  VERSION = &quot;0.1.2&quot;
 
   def self.included(base)
     Soup.prepare
@@ -20,6 +20,12 @@ module Pottery
     def restore name
       snip = Soup[name]
       if snip &amp;&amp; snip != []
+        if snip.is_a? Array
+          last = snip.pop
+          puts 'deleting duplicates for id: ' + name
+          snip.each {|x| x.destroy}
+          snip = last
+        end
         instance = self.new
         attributes = snip.attributes
         unless attributes.empty?
@@ -40,7 +46,18 @@ module Pottery
 
     def save
       if respond_to?('id_name') &amp;&amp; !id_name.nil? &amp;&amp; !(id_name.to_s.strip.size == 0)
-        snip = Pottery::PotterySnip.new
+        existing = Soup[id_name]
+        if existing &amp;&amp; existing != []
+          if existing.is_a? Array
+            last = existing.pop
+            puts 'deleting duplicates for id: ' + id_name
+            existing.each {|x| x.destroy}
+            existing = last
+          end
+          snip = Pottery::PotterySnip.new existing.attributes.merge({:__id =&gt; existing.id})
+        else
+          snip = Pottery::PotterySnip.new
+        end
         morph_attributes.each_pair do |symbol, value|
           symbol = convert_if_name_or_id_name(symbol)
           snip.set_value(symbol.to_s, value)</diff>
      <filename>lib/pottery.rb</filename>
    </modified>
    <modified>
      <diff>@@ -52,6 +52,7 @@ describe Pottery, &quot;when save method is called after id_name has been set&quot; do
     initialize_pottery_and_snip
     @pottery.id_name = 'red'
     @snip.should_receive(:save)
+    Soup.should_receive('[]'.to_sym).with('red').and_return []
     @pottery.save
   end
 
@@ -61,6 +62,7 @@ describe Pottery, &quot;when save method is called after id_name has been set&quot; do
 
     @snip.stub!(:save)
     @snip.should_receive(:set_value).with('name', 'red')
+    Soup.should_receive('[]'.to_sym).with('red').and_return []
     @pottery.save
   end
 end
@@ -76,6 +78,7 @@ describe Pottery, &quot;when save method is called after name and id_name has been se
     @pottery.id_name = 'red'
     @pottery.name = 'blue'
     @snip.should_receive(:save)
+    Soup.should_receive('[]'.to_sym).with('red').and_return []
     @pottery.save
   end
 
@@ -87,6 +90,7 @@ describe Pottery, &quot;when save method is called after name and id_name has been se
     @snip.stub!(:save)
     @snip.should_receive(:set_value).with('name', 'red')
     @snip.should_receive(:set_value).with('name_name', 'blue')
+    Soup.should_receive('[]'.to_sym).with('red').and_return []
     @pottery.save
   end
 end</diff>
      <filename>spec/pottery_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8a02c3d6d1489a39f0e6d67e1e294d7f35df20a0</id>
    </parent>
  </parents>
  <author>
    <name>robmckinnon</name>
    <email>rob@theyworkforyou.co.nz</email>
  </author>
  <url>http://github.com/robmckinnon/pottery/commit/e1346faf85cfbe5f8a2c78f4e4ae3997f8792ff0</url>
  <id>e1346faf85cfbe5f8a2c78f4e4ae3997f8792ff0</id>
  <committed-date>2009-01-01T06:12:05-08:00</committed-date>
  <authored-date>2009-01-01T06:12:05-08:00</authored-date>
  <message>ensure id_names are unique; ready for 0.1.2 release</message>
  <tree>6a9a62e9eee9a2981a613774a5f36f4d7ff3c475</tree>
  <committer>
    <name>robmckinnon</name>
    <email>rob@theyworkforyou.co.nz</email>
  </committer>
</commit>
