<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,7 +3,7 @@ class ActsLikeGitGenerator &lt; Rails::Generator::NamedBase
     record do |m|
       m.migration_template 'migration:migration.rb', &quot;db/migrate&quot;, {
         :assigns =&gt; version_attributes, 
-        :migration_file_name =&gt; &quot;add_current_version_field_to_#{custom_file_name}&quot; 
+        :migration_file_name =&gt; &quot;add_version_field_to_#{custom_file_name}&quot; 
       }
     end
   end
@@ -18,9 +18,9 @@ private
   def version_attributes
     returning(assigns = {}) do
       assigns[:migration_action] = &quot;add&quot; 
-      assigns[:class_name] = &quot;add_current_version_field_to_#{custom_file_name}&quot; 
+      assigns[:class_name] = &quot;add_version_field_to_#{custom_file_name}&quot; 
       assigns[:table_name] = custom_file_name
-      assigns[:attributes] = [Rails::Generator::GeneratedAttribute.new(&quot;current_version&quot;, &quot;string&quot;)]
+      assigns[:attributes] = [Rails::Generator::GeneratedAttribute.new(&quot;version&quot;, &quot;string&quot;)]
     end
   end
 end</diff>
      <filename>generators/acts_like_git/acts_like_git_generator.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,14 @@ module ActsLikeGit
       # Add all the changes to this model to git
       def git_commit
         init_structure
-        add_all_changes_to_git
+        sha = add_all_changes_to_git
+        
+        if self.attributes.has_key?(&quot;version&quot;) 
+          self.version = sha
+          self.connection.update(&quot;UPDATE #{self.class.table_name} SET version='#{sha}' WHERE id='#{self.id}'&quot;)
+        end
+        
+        return sha
       end
 
       def git_delete</diff>
      <filename>lib/acts_like_git/active_record_ext/git.rb</filename>
    </modified>
    <modified>
      <diff>@@ -77,7 +77,11 @@ context &quot;A Post that versions a title field&quot; do
       @post.title = 'Moo2'
       @post.title.should == 'Moo2'
     end
-    
+      
+    it &quot;should save current sha1 to version field&quot; do
+      @post.version.should == @post.log.first
+      Post.find(@post.id).version.should == @post.log.first
+    end
   end
   
   describe &quot;reverting&quot; do</diff>
      <filename>spec/unit/post_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6816d556f05a1c707cc2fcb9142915fdb5cabfd2</id>
    </parent>
  </parents>
  <author>
    <name>Nick Quaranto</name>
    <email>nick@quaran.to</email>
  </author>
  <url>http://github.com/courtenay/acts_like_git/commit/d2a6eb61bd497000f71aa79f69482443f623f707</url>
  <id>d2a6eb61bd497000f71aa79f69482443f623f707</id>
  <committed-date>2008-12-12T10:48:19-08:00</committed-date>
  <authored-date>2008-12-12T10:48:19-08:00</authored-date>
  <message>Updating version field after commit is done with current version sha. Modified generator accordingly.</message>
  <tree>a1bcf2aba9c41bf3ecfe93a8a08a9b15010c2264</tree>
  <committer>
    <name>Nick Quaranto</name>
    <email>nick@quaran.to</email>
  </committer>
</commit>
