<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/fixtures/page.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1 +1,2 @@
-test/debug.log
\ No newline at end of file
+test/*.log
+*.db
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,8 @@
 == version_fu
 Copyright (c) 2008 Jordan McKible
+
+== acts_as_versioned
+Copyright (c) 2005 Rick Olson
 ====================================================================
 
 Permission is hereby granted, free of charge, to any person obtaining a copy of </diff>
      <filename>MIT-LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -3,3 +3,4 @@ version_fu
 
 version_fu is a ActveRecord versioning plugin that takes advantage of the new dirty attribute checking available in Edge Rails (to be released in version 2.1). Previous solutions like Rick Olsen's acts_as_versioned are no long compatible with Rails.
 
+This is definitely a work in progress.  I'm currently just transitioning the elements of acts_as_versioned I use in one project. 
\ No newline at end of file</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -1 +1 @@
-version_fu is being developed against Edge Rails, so it needs to load ../vendor/rails
\ No newline at end of file
+version_fu is being developed against Edge Rails, so it needs to be available vendor/rails
\ No newline at end of file</diff>
      <filename>RUNNING_UNIT_TESTS</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,53 @@
 module VersionFu
   def self.included(base)
-    base.extend(ClassMethods)
+    base.extend ClassMethods
   end
-  
+
   module ClassMethods
+    def version_fu
+      return if self.included_modules.include? VersionFu::InstanceMethods
+      __send__ :include, VersionFu::InstanceMethods
+
+      cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, :versioned_inheritance_column, 
+        :version_column, :non_versioned_columns
+        
+      send :attr_accessor, :aav_changed_attributes
+
+      self.versioned_class_name         = &quot;Version&quot;
+      self.versioned_foreign_key        = self.to_s.foreign_key
+      self.versioned_table_name         = &quot;#{table_name_prefix}#{base_class.name.demodulize.underscore}_versions#{table_name_suffix}&quot;
+      self.versioned_inheritance_column = &quot;versioned_#{inheritance_column}&quot;
+      self.version_column               = 'version'
+      self.non_versioned_columns        = [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column]
+
+      # Setup versions association
+      class_eval do
+        has_many :versions, :class_name  =&gt; &quot;#{self.to_s}::#{versioned_class_name}&quot;,
+                            :foreign_key =&gt; versioned_foreign_key,
+                            :order       =&gt; 'version',
+                            :dependent   =&gt; :delete_all
+      end
+
+      # Versioned Model
+      const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do
+        def self.reloadable? ; false ; end
+      end
+
+      versioned_class.cattr_accessor :original_class
+      versioned_class.original_class = self
+      versioned_class.set_table_name versioned_table_name
+      versioned_class.belongs_to self.to_s.demodulize.underscore.to_sym, 
+        :class_name  =&gt; &quot;::#{self.to_s}&quot;, 
+        :foreign_key =&gt; versioned_foreign_key
+    end
     
-    def version_fu(options={})
-      
+    def versioned_class
+      const_get versioned_class_name
     end
     
   end
-  
+
+
   module InstanceMethods
   end
   </diff>
      <filename>lib/version_fu.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,6 @@ postgresql:
 mysql:
   :adapter: mysql
   :host: localhost
-  :username: rails
+  :username: root
   :password:
   :database: version_fu_plugin_test
\ No newline at end of file</diff>
      <filename>test/database.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,5 @@
-welcome:
+welcome_1:
+  id: 1
   page_id: 1
   version: 1
   title: Welcome</diff>
      <filename>test/fixtures/page_versions.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,5 +1,3 @@
-$:.unshift(File.dirname(__FILE__) + '/../lib')
-
 require 'test/unit'
 require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
 require 'rubygems'
@@ -7,27 +5,15 @@ require 'active_record/fixtures'
 
 config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
 ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + &quot;/debug.log&quot;)
-ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
+ActiveRecord::Base.configurations = {'test' =&gt; config[ENV['DB'] || 'sqlite3']}
+ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
 
 load(File.dirname(__FILE__) + &quot;/schema.rb&quot;)
 
 Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + &quot;/fixtures/&quot;
-$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
-
-class Test::Unit::TestCase #:nodoc:
-  def create_fixtures(*table_names)
-    if block_given?
-      Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
-    else
-      Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
-    end
-  end
+$:.unshift(Test::Unit::TestCase.fixture_path)
 
-  # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
+class Test::Unit::TestCase
   self.use_transactional_fixtures = true
-  
-  # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
   self.use_instantiated_fixtures  = false
-
-  # Add more helper methods to be used by all tests here...
-end
+end
\ No newline at end of file</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,13 +1,16 @@
 require File.join(File.dirname(__FILE__), 'test_helper')
-
-class Page &lt; ActiveRecord::Base
-  version_fu
-end
+require File.join(File.dirname(__FILE__), 'fixtures/page')
 
 class VersionFuTest &lt; Test::Unit::TestCase
   fixtures :pages, :page_versions
+  set_fixture_class :page_versions =&gt; Page::Version
+  
+  def test_parent_has_many_version
+    assert_equal pages(:welcome).versions, [page_versions(:welcome_1)]
+  end
   
-  def test_true
-    assert true
+  def test_version_belongs_to_parent
+    assert_equal page_versions(:welcome_1).page, pages(:welcome)
   end
+  
 end
\ No newline at end of file</diff>
      <filename>test/version_fu_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4204d64ce2ad151f969753fe7dafdbf3a12f4735</id>
    </parent>
  </parents>
  <author>
    <name>Jordan McKible</name>
    <email>jordan@mckible.com</email>
  </author>
  <url>http://github.com/jmckible/version_fu/commit/5a1bedc3e323c8c297738f0f8a7f7841259680e9</url>
  <id>5a1bedc3e323c8c297738f0f8a7f7841259680e9</id>
  <committed-date>2008-04-27T17:39:29-07:00</committed-date>
  <authored-date>2008-04-27T17:39:29-07:00</authored-date>
  <message>Setup test infrastructure.  Versioned class associations.</message>
  <tree>edc6bda1104fc595f8c273ccd345caae62621a91</tree>
  <committer>
    <name>Jordan McKible</name>
    <email>jordan@mckible.com</email>
  </committer>
</commit>
