<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -4,7 +4,13 @@ class ConvertVersionedAssociationFromHashToObject &lt; ActiveRecord::Migration
       attributes = YAML::load(version.yaml)
       if attributes[&quot;parts&quot;]
         attributes[&quot;parts&quot;].collect! do |part_attributes|
-          PagePart.send(:instantiate, part_attributes)
+          part_attributes.delete(&quot;page_id&quot;)
+          if existing_part = PagePart.find_by_page_id_and_name(version.versionable_id, part_attributes[&quot;name&quot;])
+              existing_part.attributes = part_attributes
+              existing_part
+          else
+            PagePart.send(:instantiate, part_attributes)
+          end
         end
         version.update_attributes( :yaml =&gt; attributes.to_yaml )
       end</diff>
      <filename>db/migrate/20090626143038_convert_versioned_association_from_hash_to_object.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e518c3f2175bd5d8b6dd711e4f7502fe614a5f09</id>
    </parent>
  </parents>
  <author>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </author>
  <url>http://github.com/jgarber/radiant-chronicle-extension/commit/0b97ec906b23f61a2ed1787d4ace265141e70d02</url>
  <id>0b97ec906b23f61a2ed1787d4ace265141e70d02</id>
  <committed-date>2009-09-21T11:56:53-07:00</committed-date>
  <authored-date>2009-09-21T11:56:53-07:00</authored-date>
  <message>Combining the migrations from c8a0339 and e518c3 so it might actually convert properly this time without creating page parts that duplicate themselves when edited because they're missing ids.</message>
  <tree>7a1cdbd30e5e5f3d46383f90e071cf958d2fa3d7</tree>
  <committer>
    <name>Jason Garber</name>
    <email>jg@jasongarber.com</email>
  </committer>
</commit>
