<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -13,7 +13,7 @@ class Event &lt; ActiveRecord::Base
 
   protected
     def content_and_user_added
-      errors.add_to_base &quot;Title or Body must be changed&quot; unless %w(publish comment).include?(mode) || article.changed?(:title) || article.changed?(:body)
+      errors.add_to_base &quot;Title or Body must be changed&quot; unless %w(publish comment).include?(mode) || article.changed.include?('title') || article.changed.include?('body')
       errors.add_to_base &quot;User must be provided for Article events&quot;   unless (mode == 'comment' &amp;&amp; author) || user_id
     end
 end</diff>
      <filename>app/models/event.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,12 @@
-*SVN* (version numbers are overrated)
+*GIT* (version numbers are overrated)
+
+* (16 Jun 2008) Backwards Compatibility is overrated (big updates for rails 2.1)
+
+  * Use ActiveRecord 2.1's dirty attribute checking instead [Asa Calow]
+  * Remove last traces of #non_versioned_fields
+  * Remove AR::Base.find_version and AR::Base.find_versions, rely on AR association proxies and named_scope
+  * Remove #versions_count, rely on AR association counter caching.
+  * Remove #versioned_attributes, basically the same as AR::Base.versioned_columns
 
 * (5 Oct 2006) Allow customization of #versions association options [Dan Peterson]
 </diff>
      <filename>vendor/plugins/acts_as_versioned/CHANGELOG</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,5 @@
 require 'rubygems'
 
-Gem::manage_gems
-
 require 'rake/rdoctask'
 require 'rake/packagetask'
 require 'rake/gempackagetask'</diff>
      <filename>vendor/plugins/acts_as_versioned/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -22,7 +22,7 @@
 module ActiveRecord #:nodoc:
   module Acts #:nodoc:
     # Specify this act if you want to save a copy of the row in a versioned table.  This assumes there is a 
-    # versioned table ready and that your model has a version field.  This works with optimisic locking if the lock_version
+    # versioned table ready and that your model has a version field.  This works with optimistic locking if the lock_version
     # column is present as well.
     #
     # The class for the versioned model is derived the first time it is seen. Therefore, if you change your database schema you have to restart
@@ -49,9 +49,24 @@ module ActiveRecord #:nodoc:
     #   page.revert_to(page.versions.last) # using versioned instance
     #   page.title         # =&gt; 'hello world'
     #
+    #   page.versions.earliest # efficient query to find the first version
+    #   page.versions.latest   # efficient query to find the most recently created version
+    #
+    #
+    # Simple Queries to page between versions
+    #
+    #   page.versions.before(version) 
+    #   page.versions.after(version)
+    #
+    # Access the previous/next versions from the versioned model itself
+    #
+    #   version = page.versions.latest
+    #   version.previous # go back one version
+    #   version.next     # go forward one version
+    #
     # See ActiveRecord::Acts::Versioned::ClassMethods#acts_as_versioned for configuration options
     module Versioned
-      CALLBACKS = [:set_new_version, :save_version_on_create, :save_version?, :clear_changed_attributes]
+      CALLBACKS = [:set_new_version, :save_version, :save_version?]
       def self.included(base) # :nodoc:
         base.extend ClassMethods
       end
@@ -80,12 +95,7 @@ module ActiveRecord #:nodoc:
         #     end
         #
         # * &lt;tt&gt;if_changed&lt;/tt&gt; - Simple way of specifying attributes that are required to be changed before saving a model.  This takes
-        #   either a symbol or array of symbols.  WARNING - This will attempt to overwrite any attribute setters you may have.  
-        #   Use this instead if you want to write your own attribute setters (and ignore if_changed):
-        # 
-        #     def name=(new_name)
-        #       write_changed_attribute :name, new_name
-        #     end
+        #   either a symbol or array of symbols.
         #
         # * &lt;tt&gt;extend&lt;/tt&gt; - Lets you specify a module to be mixed in both the original and versioned models.  You can also just pass a block
         #   to create an anonymous mixin:
@@ -133,7 +143,7 @@ module ActiveRecord #:nodoc:
         #       # that create_table does
         #       Post.create_versioned_table
         #     end
-        #   
+        # 
         #     def self.down
         #       Post.drop_versioned_table
         #     end
@@ -157,21 +167,10 @@ module ActiveRecord #:nodoc:
           return if self.included_modules.include?(ActiveRecord::Acts::Versioned::ActMethods)
 
           send :include, ActiveRecord::Acts::Versioned::ActMethods
-          
-          cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, :versioned_inheritance_column, 
-            :version_column, :max_version_limit, :track_changed_attributes, :version_condition, :version_sequence_name, :non_versioned_columns,
-            :version_association_options
-            
-          # legacy
-          alias_method :non_versioned_fields,  :non_versioned_columns
-          alias_method :non_versioned_fields=, :non_versioned_columns=
 
-          class &lt;&lt; self
-            alias_method :non_versioned_fields,  :non_versioned_columns
-            alias_method :non_versioned_fields=, :non_versioned_columns=
-          end
-
-          send :attr_accessor, :changed_attributes
+          cattr_accessor :versioned_class_name, :versioned_foreign_key, :versioned_table_name, :versioned_inheritance_column, 
+            :version_column, :max_version_limit, :track_altered_attributes, :version_condition, :version_sequence_name, :non_versioned_columns,
+            :version_association_options, :version_if_changed
 
           self.versioned_class_name         = options[:class_name]  || &quot;Version&quot;
           self.versioned_foreign_key        = options[:foreign_key] || self.to_s.foreign_key
@@ -181,11 +180,10 @@ module ActiveRecord #:nodoc:
           self.version_sequence_name        = options[:sequence_name]
           self.max_version_limit            = options[:limit].to_i
           self.version_condition            = options[:if] || true
-          self.non_versioned_columns        = [self.primary_key, inheritance_column, 'version', 'lock_version', versioned_inheritance_column]
+          self.non_versioned_columns        = [self.primary_key, inheritance_column, self.version_column, 'lock_version', versioned_inheritance_column, 'created_at', 'created_on'] + options[:non_versioned_columns].to_a.map(&amp;:to_s)
           self.version_association_options  = {
                                                 :class_name  =&gt; &quot;#{self.to_s}::#{versioned_class_name}&quot;,
-                                                :foreign_key =&gt; &quot;#{versioned_foreign_key}&quot;,
-                                                :order       =&gt; 'version',
+                                                :foreign_key =&gt; versioned_foreign_key,
                                                 :dependent   =&gt; :delete_all
                                               }.merge(options[:association_options] || {})
 
@@ -194,62 +192,91 @@ module ActiveRecord #:nodoc:
             silence_warnings do
               self.const_set(extension_module_name, Module.new(&amp;extension))
             end
-            
+
             options[:extend] = self.const_get(extension_module_name)
           end
 
-          class_eval do
-            has_many :versions, version_association_options
+          class_eval &lt;&lt;-CLASS_METHODS
+            has_many :versions, version_association_options do
+              # finds earliest version of this record
+              def earliest
+                @earliest ||= find(:first, :order =&gt; '#{version_column}')
+              end
+
+              # find latest version of this record
+              def latest
+                @latest ||= find(:first, :order =&gt; '#{version_column} desc')
+              end
+            end
             before_save  :set_new_version
-            after_create :save_version_on_create
-            after_update :save_version
+            after_save   :save_version
             after_save   :clear_old_versions
-            after_save   :clear_changed_attributes
-            
+
             unless options[:if_changed].nil?
-              self.track_changed_attributes = true
+              self.track_altered_attributes = true
               options[:if_changed] = [options[:if_changed]] unless options[:if_changed].is_a?(Array)
-              options[:if_changed].each do |attr_name|
-                define_method(&quot;#{attr_name}=&quot;) do |value|
-                  write_changed_attribute attr_name, value
-                end
-              end
+              self.version_if_changed = options[:if_changed].map(&amp;:to_s)
             end
-            
+
             include options[:extend] if options[:extend].is_a?(Module)
-          end
+          CLASS_METHODS
 
           # create the dynamic versioned model
           const_set(versioned_class_name, Class.new(ActiveRecord::Base)).class_eval do
             def self.reloadable? ; false ; end
+            # find first version before the given version
+            def self.before(version)
+              find :first, :order =&gt; 'version desc',
+                :conditions =&gt; [&quot;#{original_class.versioned_foreign_key} = ? and version &lt; ?&quot;, version.send(original_class.versioned_foreign_key), version.version]
+            end
+
+            # find first version after the given version.
+            def self.after(version)
+              find :first, :order =&gt; 'version',
+                :conditions =&gt; [&quot;#{original_class.versioned_foreign_key} = ? and version &gt; ?&quot;, version.send(original_class.versioned_foreign_key), version.version]
+            end
+
+            def previous
+              self.class.before(self)
+            end
+
+            def next
+              self.class.after(self)
+            end
+
+            def versions_count
+              page.version
+            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
           versioned_class.send :include, options[:extend]         if options[:extend].is_a?(Module)
           versioned_class.set_sequence_name version_sequence_name if version_sequence_name
+          
+          create_versioned_table
         end
       end
-    
+
       module ActMethods
         def self.included(base) # :nodoc:
           base.extend ClassMethods
         end
-        
-        # Saves a version of the model if applicable
-        def save_version
-          save_version_on_create if save_version?
-        end
-        
+
         # Saves a version of the model in the versioned table.  This is called in the after_save callback by default
-        def save_version_on_create
-          rev = self.class.versioned_class.new
-          self.clone_versioned_model(self, rev)
-          rev.version = send(self.class.version_column)
-          rev.send(&quot;#{self.class.versioned_foreign_key}=&quot;, self.id)
-          rev.save
+        def save_version
+          if @saving_version
+            @saving_version = nil
+            rev = self.class.versioned_class.new
+            clone_versioned_model(self, rev)
+            rev.send(&quot;#{self.class.version_column}=&quot;, send(self.class.version_column))
+            rev.send(&quot;#{self.class.versioned_foreign_key}=&quot;, id)
+            rev.save
+          end
         end
 
         # Clears old revisions if a limit is set with the :limit option in &lt;tt&gt;acts_as_versioned&lt;/tt&gt;.
@@ -258,36 +285,23 @@ module ActiveRecord #:nodoc:
           return if self.class.max_version_limit == 0
           excess_baggage = send(self.class.version_column).to_i - self.class.max_version_limit
           if excess_baggage &gt; 0
-            sql = &quot;DELETE FROM #{self.class.versioned_table_name} WHERE version &lt;= #{excess_baggage} AND #{self.class.versioned_foreign_key} = #{self.id}&quot;
-            self.class.versioned_class.connection.execute sql
+            self.class.versioned_class.delete_all [&quot;#{self.class.version_column} &lt;= ? and #{self.class.versioned_foreign_key} = ?&quot;, excess_baggage, id]
           end
         end
 
-        # Finds a specific version of this model.
-        def find_version(version)
-          return version if version.is_a?(self.class.versioned_class)
-          return nil if version.is_a?(ActiveRecord::Base)
-          find_versions(:conditions =&gt; ['version = ?', version], :limit =&gt; 1).first
-        end
-        
-        # Finds versions of this model.  Takes an options hash like &lt;tt&gt;find&lt;/tt&gt;
-        def find_versions(options = {})
-          versions.find(:all, options)
-        end
-
         # Reverts a model to a given version.  Takes either a version number or an instance of the versioned model
         def revert_to(version)
           if version.is_a?(self.class.versioned_class)
-            return false unless version.send(self.class.versioned_foreign_key) == self.id and !version.new_record?
+            return false unless version.send(self.class.versioned_foreign_key) == id and !version.new_record?
           else
-            return false unless version = find_version(version)
+            return false unless version = versions.send(&quot;find_by_#{self.class.version_column}&quot;, version)
           end
           self.clone_versioned_model(version, self)
-          self.send(&quot;#{self.class.version_column}=&quot;, version.version)
+          send(&quot;#{self.class.version_column}=&quot;, version.send(self.class.version_column))
           true
         end
 
-        # Reverts a model to a given version and saves the model.  
+        # Reverts a model to a given version and saves the model.
         # Takes either a version number or an instance of the versioned model
         def revert_to!(version)
           revert_to(version) ? save_without_revision : false
@@ -308,41 +322,29 @@ module ActiveRecord #:nodoc:
             end
           end
         end
-
-        # Returns an array of attribute keys that are versioned.  See non_versioned_columns
-        def versioned_attributes
-          self.attributes.keys.select { |k| !self.class.non_versioned_columns.include?(k) }
-        end
         
-        # If called with no parameters, gets whether the current model has changed and needs to be versioned.
-        # If called with a single parameter, gets whether the parameter has changed.
-        def changed?(attr_name = nil)
-          attr_name.nil? ?
-            (!self.class.track_changed_attributes || (changed_attributes &amp;&amp; changed_attributes.length &gt; 0)) :
-            (changed_attributes &amp;&amp; changed_attributes.include?(attr_name.to_s))
+        def altered?
+          track_altered_attributes ? (version_if_changed - changed).length &lt; version_if_changed.length : changed?
         end
-        
-        # keep old dirty? method
-        alias_method :dirty?, :changed?
-        
+
         # Clones a model.  Used when saving a new version or reverting a model's version.
         def clone_versioned_model(orig_model, new_model)
-          self.versioned_attributes.each do |key|
-            new_model.send(&quot;#{key}=&quot;, orig_model.attributes[key]) if orig_model.has_attribute?(key)
+          self.class.versioned_columns.each do |col|
+            new_model.send(&quot;#{col.name}=&quot;, orig_model.send(col.name)) if orig_model.has_attribute?(col.name)
           end
-          
+
           if orig_model.is_a?(self.class.versioned_class)
             new_model[new_model.class.inheritance_column] = orig_model[self.class.versioned_inheritance_column]
           elsif new_model.is_a?(self.class.versioned_class)
             new_model[self.class.versioned_inheritance_column] = orig_model[orig_model.class.inheritance_column]
           end
         end
-        
+
         # Checks whether a new version shall be saved or not.  Calls &lt;tt&gt;version_condition_met?&lt;/tt&gt; and &lt;tt&gt;changed?&lt;/tt&gt;.
         def save_version?
-          version_condition_met? &amp;&amp; changed?
+          version_condition_met? &amp;&amp; altered?
         end
-        
+
         # Checks condition set in the :if option to check whether a revision should be created or not.  Override this for
         # custom version condition checking.
         def version_condition_met?
@@ -353,7 +355,7 @@ module ActiveRecord #:nodoc:
             version_condition.call(self)
           else
             version_condition
-          end          
+          end
         end
 
         # Executes the block with the versioning callbacks disabled.
@@ -378,55 +380,24 @@ module ActiveRecord #:nodoc:
 
         def empty_callback() end #:nodoc:
 
-        protected          
+        protected
           # sets the new version before saving, unless you're using optimistic locking.  In that case, let it take care of the version.
           def set_new_version
-            self.send(&quot;#{self.class.version_column}=&quot;, self.next_version) if new_record? || (!locking_enabled? &amp;&amp; save_version?)
+            @saving_version = new_record? || save_version?
+            self.send(&quot;#{self.class.version_column}=&quot;, next_version) if new_record? || (!locking_enabled? &amp;&amp; save_version?)
           end
-          
+
           # Gets the next available version for the current record, or 1 for a new record
           def next_version
-            return 1 if new_record?
-            (versions.calculate(:max, :version) || 0) + 1
-          end
-          
-          # clears current changed attributes.  Called after save.
-          def clear_changed_attributes
-            self.changed_attributes = []
-          end
-
-          def write_changed_attribute(attr_name, attr_value)
-            # Convert to db type for comparison. Avoids failing Float&lt;=&gt;String comparisons.
-            attr_value_for_db = self.class.columns_hash[attr_name.to_s].type_cast(attr_value)
-            (self.changed_attributes ||= []) &lt;&lt; attr_name.to_s unless self.changed?(attr_name) || self.send(attr_name) == attr_value_for_db
-            write_attribute(attr_name, attr_value_for_db)
-          end
-
-        private
-          CALLBACKS.each do |attr_name| 
-            alias_method &quot;orig_#{attr_name}&quot;.to_sym, attr_name
+            (new_record? ? 0 : versions.calculate(:max, version_column).to_i) + 1
           end
 
         module ClassMethods
-          # Finds a specific version of a specific row of this model
-          def find_version(id, version)
-            find_versions(id, 
-              :conditions =&gt; [&quot;#{versioned_foreign_key} = ? AND version = ?&quot;, id, version], 
-              :limit =&gt; 1).first
-          end
-        
-          # Finds versions of a specific model.  Takes an options hash like &lt;tt&gt;find&lt;/tt&gt;
-          def find_versions(id, options = {})
-            versioned_class.find :all, {
-              :conditions =&gt; [&quot;#{versioned_foreign_key} = ?&quot;, id],
-              :order      =&gt; 'version' }.merge(options)
-          end
-
           # Returns an array of columns that are versioned.  See non_versioned_columns
           def versioned_columns
-            self.columns.select { |c| !non_versioned_columns.include?(c.name) }
+            @versioned_columns ||= columns.select { |c| !non_versioned_columns.include?(c.name) }
           end
-    
+
           # Returns an instance of the dynamic versioned model
           def versioned_class
             const_get versioned_class_name
@@ -435,39 +406,48 @@ module ActiveRecord #:nodoc:
           # Rake migration task to create the versioned table using options passed to acts_as_versioned
           def create_versioned_table(create_table_options = {})
             # create version column in main table if it does not exist
-            if !self.content_columns.find { |c| %w(version lock_version).include? c.name }
-              self.connection.add_column table_name, :version, :integer
+            if !self.content_columns.find { |c| [version_column.to_s, 'lock_version'].include? c.name }
+              self.connection.add_column table_name, version_column, :integer
+              self.reset_column_information
             end
+
+            return if connection.tables.include?(versioned_table_name.to_s)
             
             self.connection.create_table(versioned_table_name, create_table_options) do |t|
               t.column versioned_foreign_key, :integer
-              t.column :version, :integer
+              t.column version_column, :integer
             end
-            
+
             updated_col = nil
             self.versioned_columns.each do |col| 
               updated_col = col if !updated_col &amp;&amp; %(updated_at updated_on).include?(col.name)
               self.connection.add_column versioned_table_name, col.name, col.type, 
-                :limit =&gt; col.limit, 
-                :default =&gt; col.default
+                :limit     =&gt; col.limit, 
+                :default   =&gt; col.default,
+                :scale     =&gt; col.scale,
+                :precision =&gt; col.precision
             end
-        
+
             if type_col = self.columns_hash[inheritance_column]
               self.connection.add_column versioned_table_name, versioned_inheritance_column, type_col.type, 
-                :limit =&gt; type_col.limit, 
-                :default =&gt; type_col.default
+                :limit     =&gt; type_col.limit, 
+                :default   =&gt; type_col.default,
+                :scale     =&gt; type_col.scale,
+                :precision =&gt; type_col.precision
             end
-    
+
             if updated_col.nil?
               self.connection.add_column versioned_table_name, :updated_at, :timestamp
             end
+            
+            self.connection.create_index versioned_table_name, versioned_foreign_key
           end
-          
+
           # Rake migration task to drop the versioned table
           def drop_versioned_table
             self.connection.drop_table versioned_table_name
           end
-          
+
           # Executes the block with the versioning callbacks disabled.
           #
           #   Foo.without_revision do
@@ -476,17 +456,18 @@ module ActiveRecord #:nodoc:
           #
           def without_revision(&amp;block)
             class_eval do 
-              CALLBACKS.each do |attr_name| 
+              CALLBACKS.each do |attr_name|
+                alias_method &quot;orig_#{attr_name}&quot;.to_sym, attr_name
                 alias_method attr_name, :empty_callback
               end
             end
-            result = block.call
+            block.call
+          ensure
             class_eval do 
               CALLBACKS.each do |attr_name|
                 alias_method attr_name, &quot;orig_#{attr_name}&quot;.to_sym
               end
             end
-            result
           end
 
           # Turns off optimistic locking for the duration of the block
@@ -501,7 +482,7 @@ module ActiveRecord #:nodoc:
             result = block.call
             ActiveRecord::Base.lock_optimistically = true if current
             result
-          end          
+          end
         end
       end
     end</diff>
      <filename>vendor/plugins/acts_as_versioned/lib/acts_as_versioned.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,12 +1,28 @@
+$:.unshift(File.dirname(__FILE__) + '/../../../rails/activesupport/lib')
+$:.unshift(File.dirname(__FILE__) + '/../../../rails/activerecord/lib')
 $:.unshift(File.dirname(__FILE__) + '/../lib')
-
 require 'test/unit'
-require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
-require 'active_record/fixtures'
+begin
+  require 'active_support'
+  require 'active_record'
+  require 'active_record/fixtures'
+rescue LoadError
+  require 'rubygems'
+  retry
+end
+
+begin
+  require 'ruby-debug'
+  Debugger.start
+rescue LoadError
+end
+
+require 'acts_as_versioned'
 
 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'] || 'sqlite'])
+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;)
 
@@ -19,17 +35,9 @@ if ENV['DB'] == 'postgresql'
 end
 
 Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + &quot;/fixtures/&quot;
-$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_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
-
   # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
   self.use_transactional_fixtures = true
   </diff>
      <filename>vendor/plugins/acts_as_versioned/test/abstract_unit.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,4 +3,5 @@ washington:
     name: Washington, D.C.
     latitude: 38.895
     longitude: -77.036667
+    doesnt_trigger_version: This is not important
     version: 1</diff>
      <filename>vendor/plugins/acts_as_versioned/test/fixtures/landmarks.yml</filename>
    </modified>
    <modified>
      <diff>@@ -2,26 +2,26 @@ welcome_1:
   id: 1
   page_id: 1
   title: Welcome to the weblg
-  version: 23
+  lock_version: 23
   version_type: LockedPage
 
 welcome_2:
   id: 2
   page_id: 1
   title: Welcome to the weblog
-  version: 24
+  lock_version: 24
   version_type: LockedPage
 
 thinking_1:
   id: 3
   page_id: 2
   title: So I was thinking!!!
-  version: 23
+  lock_version: 23
   version_type: SpecialLockedPage
 
 thinking_2:
   id: 4
   page_id: 2
   title: So I was thinking
-  version: 24
+  lock_version: 24
   version_type: SpecialLockedPage</diff>
      <filename>vendor/plugins/acts_as_versioned/test/fixtures/locked_pages_revisions.yml</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@ class AddVersionedTables &lt; ActiveRecord::Migration
   def self.up
     create_table(&quot;things&quot;) do |t|
       t.column :title, :text
+      t.column :price, :decimal, :precision =&gt; 7, :scale =&gt; 2
+      t.column :type, :string
     end
     Thing.create_versioned_table
   end</diff>
      <filename>vendor/plugins/acts_as_versioned/test/fixtures/migrations/1_add_versioned_tables.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,4 +4,5 @@ welcome:
   body: Such a lovely day
   version: 24
   author_id: 1
-  revisor_id: 1
\ No newline at end of file
+  revisor_id: 1
+  created_on: &quot;2008-01-01 00:00:00&quot;
\ No newline at end of file</diff>
      <filename>vendor/plugins/acts_as_versioned/test/fixtures/pages.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 class Widget &lt; ActiveRecord::Base
   acts_as_versioned :sequence_name =&gt; 'widgets_seq', :association_options =&gt; {
-    :dependent =&gt; nil, :order =&gt; 'version desc'
+    :dependent =&gt; :nullify, :order =&gt; 'version desc'
   }
   non_versioned_columns &lt;&lt; 'foo'
 end
\ No newline at end of file</diff>
      <filename>vendor/plugins/acts_as_versioned/test/fixtures/widget.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,10 +8,15 @@ if ActiveRecord::Base.connection.supports_migrations?
 
   class MigrationTest &lt; Test::Unit::TestCase
     self.use_transactional_fixtures = false
-    def teardown
-      ActiveRecord::Base.connection.initialize_schema_information
-      ActiveRecord::Base.connection.update &quot;UPDATE schema_info SET version = 0&quot;
-
+    def teardown
+      if ActiveRecord::Base.connection.respond_to?(:initialize_schema_information)
+        ActiveRecord::Base.connection.initialize_schema_information
+        ActiveRecord::Base.connection.update &quot;UPDATE schema_info SET version = 0&quot;
+      else
+        ActiveRecord::Base.connection.initialize_schema_migrations_table
+        ActiveRecord::Base.connection.assume_migrated_upto_version(0)
+      end
+      
       Thing.connection.drop_table &quot;things&quot; rescue nil
       Thing.connection.drop_table &quot;thing_versions&quot; rescue nil
       Thing.reset_column_information
@@ -21,8 +26,17 @@ if ActiveRecord::Base.connection.supports_migrations?
       assert_raises(ActiveRecord::StatementInvalid) { Thing.create :title =&gt; 'blah blah' }
       # take 'er up
       ActiveRecord::Migrator.up(File.dirname(__FILE__) + '/fixtures/migrations/')
-      t = Thing.create :title =&gt; 'blah blah'
+      t = Thing.create :title =&gt; 'blah blah', :price =&gt; 123.45, :type =&gt; 'Thing'
       assert_equal 1, t.versions.size
+      
+      # check that the price column has remembered its value correctly
+      assert_equal t.price,  t.versions.first.price
+      assert_equal t.title,  t.versions.first.title
+      assert_equal t[:type], t.versions.first[:type]
+      
+      # make sure that the precision of the price column has been preserved
+      assert_equal 7, Thing::Version.columns.find{|c| c.name == &quot;price&quot;}.precision
+      assert_equal 2, Thing::Version.columns.find{|c| c.name == &quot;price&quot;}.scale
 
       # now lets take 'er back down
       ActiveRecord::Migrator.down(File.dirname(__FILE__) + '/fixtures/migrations/')</diff>
      <filename>vendor/plugins/acts_as_versioned/test/migration_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ ActiveRecord::Schema.define(:version =&gt; 0) do
     t.column :version, :integer
     t.column :title, :string, :limit =&gt; 255
     t.column :body, :text
+    t.column :created_on, :datetime
     t.column :updated_on, :datetime
     t.column :author_id, :integer
     t.column :revisor_id, :integer
@@ -13,11 +14,14 @@ ActiveRecord::Schema.define(:version =&gt; 0) do
     t.column :version, :integer
     t.column :title, :string, :limit =&gt; 255
     t.column :body, :text
+    t.column :created_on, :datetime
     t.column :updated_on, :datetime
     t.column :author_id, :integer
     t.column :revisor_id, :integer
   end
   
+  add_index :page_versions, [:page_id, :version], :unique =&gt; true
+  
   create_table :authors, :force =&gt; true do |t|
     t.column :page_id, :integer
     t.column :name, :string
@@ -26,16 +30,20 @@ ActiveRecord::Schema.define(:version =&gt; 0) do
   create_table :locked_pages, :force =&gt; true do |t|
     t.column :lock_version, :integer
     t.column :title, :string, :limit =&gt; 255
+    t.column :body, :text
     t.column :type, :string, :limit =&gt; 255
   end
 
   create_table :locked_pages_revisions, :force =&gt; true do |t|
     t.column :page_id, :integer
-    t.column :version, :integer
+    t.column :lock_version, :integer
     t.column :title, :string, :limit =&gt; 255
+    t.column :body, :text
     t.column :version_type, :string, :limit =&gt; 255
     t.column :updated_at, :datetime
   end
+  
+  add_index :locked_pages_revisions, [:page_id, :lock_version], :unique =&gt; true
 
   create_table :widgets, :force =&gt; true do |t|
     t.column :name, :string, :limit =&gt; 50
@@ -51,10 +59,13 @@ ActiveRecord::Schema.define(:version =&gt; 0) do
     t.column :updated_at, :datetime
   end
   
+  add_index :widget_versions, [:widget_id, :version], :unique =&gt; true
+  
   create_table :landmarks, :force =&gt; true do |t|
     t.column :name, :string
     t.column :latitude, :float
     t.column :longitude, :float
+    t.column :doesnt_trigger_version,:string
     t.column :version, :integer
   end
 
@@ -63,6 +74,9 @@ ActiveRecord::Schema.define(:version =&gt; 0) do
     t.column :name, :string
     t.column :latitude, :float
     t.column :longitude, :float
+    t.column :doesnt_trigger_version,:string
     t.column :version, :integer
   end
+  
+  add_index :landmark_versions, [:landmark_id, :version], :unique =&gt; true
 end</diff>
      <filename>vendor/plugins/acts_as_versioned/test/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,25 +4,33 @@ require File.join(File.dirname(__FILE__), 'fixtures/widget')
 
 class VersionedTest &lt; Test::Unit::TestCase
   fixtures :pages, :page_versions, :locked_pages, :locked_pages_revisions, :authors, :landmarks, :landmark_versions
+  set_fixture_class :page_versions =&gt; Page::Version
 
   def test_saves_versioned_copy
-    p = Page.create :title =&gt; 'first title', :body =&gt; 'first body'
+    p = Page.create! :title =&gt; 'first title', :body =&gt; 'first body'
     assert !p.new_record?
     assert_equal 1, p.versions.size
     assert_equal 1, p.version
     assert_instance_of Page.versioned_class, p.versions.first
   end
 
+  def test_version_has_unique_created_at
+    p = pages(:welcome)
+    p.title = 'update me'
+    p.save!
+    assert_not_equal p.created_on, p.versions.latest.created_on
+  end
+
   def test_saves_without_revision
     p = pages(:welcome)
     old_versions = p.versions.count
-    
+
     p.save_without_revision
-    
+
     p.without_revision do
       p.update_attributes :title =&gt; 'changed'
     end
-    
+
     assert_equal old_versions, p.versions.count
   end
 
@@ -30,8 +38,8 @@ class VersionedTest &lt; Test::Unit::TestCase
     p = pages(:welcome)
     assert_equal 24, p.version
     assert_equal 'Welcome to the weblog', p.title
-    
-    assert p.revert_to!(p.versions.first.version), &quot;Couldn't revert to 23&quot;
+
+    assert p.revert_to!(23), &quot;Couldn't revert to 23&quot;
     assert_equal 23, p.version
     assert_equal 'Welcome to the weblg', p.title
   end
@@ -57,57 +65,57 @@ class VersionedTest &lt; Test::Unit::TestCase
     p = pages(:welcome)
     assert_equal 24, p.version
     assert_equal 'Welcome to the weblog', p.title
-    
-    assert p.revert_to!(p.versions.first), &quot;Couldn't revert to 23&quot;
+
+    assert p.revert_to!(p.versions.find_by_version(23)), &quot;Couldn't revert to 23&quot;
     assert_equal 23, p.version
     assert_equal 'Welcome to the weblg', p.title
   end
-  
+
   def test_rollback_fails_with_invalid_revision
     p = locked_pages(:welcome)
     assert !p.revert_to!(locked_pages(:thinking))
   end
 
   def test_saves_versioned_copy_with_options
-    p = LockedPage.create :title =&gt; 'first title'
+    p = LockedPage.create! :title =&gt; 'first title'
     assert !p.new_record?
     assert_equal 1, p.versions.size
     assert_instance_of LockedPage.versioned_class, p.versions.first
   end
-  
+
   def test_rollback_with_version_number_with_options
     p = locked_pages(:welcome)
     assert_equal 'Welcome to the weblog', p.title
     assert_equal 'LockedPage', p.versions.first.version_type
-    
-    assert p.revert_to!(p.versions.first.version), &quot;Couldn't revert to 23&quot;
+
+    assert p.revert_to!(p.versions.first.lock_version), &quot;Couldn't revert to 23&quot;
     assert_equal 'Welcome to the weblg', p.title
     assert_equal 'LockedPage', p.versions.first.version_type
   end
-  
+
   def test_rollback_with_version_class_with_options
     p = locked_pages(:welcome)
     assert_equal 'Welcome to the weblog', p.title
     assert_equal 'LockedPage', p.versions.first.version_type
-    
+
     assert p.revert_to!(p.versions.first), &quot;Couldn't revert to 1&quot;
     assert_equal 'Welcome to the weblg', p.title
     assert_equal 'LockedPage', p.versions.first.version_type
   end
-  
+
   def test_saves_versioned_copy_with_sti
-    p = SpecialLockedPage.create :title =&gt; 'first title'
+    p = SpecialLockedPage.create! :title =&gt; 'first title'
     assert !p.new_record?
     assert_equal 1, p.versions.size
     assert_instance_of LockedPage.versioned_class, p.versions.first
     assert_equal 'SpecialLockedPage', p.versions.first.version_type
   end
-  
+
   def test_rollback_with_version_number_with_sti
     p = locked_pages(:thinking)
     assert_equal 'So I was thinking', p.title
-    
-    assert p.revert_to!(p.versions.first.version), &quot;Couldn't revert to 1&quot;
+
+    assert p.revert_to!(p.versions.first.lock_version), &quot;Couldn't revert to 1&quot;
     assert_equal 'So I was thinking!!!', p.title
     assert_equal 'SpecialLockedPage', p.versions.first.version_type
   end
@@ -115,11 +123,11 @@ class VersionedTest &lt; Test::Unit::TestCase
   def test_lock_version_works_with_versioning
     p = locked_pages(:thinking)
     p2 = LockedPage.find(p.id)
-    
+
     p.title = 'fresh title'
     p.save
     assert_equal 2, p.versions.size # limit!
-    
+
     assert_raises(ActiveRecord::StaleObjectError) do
       p2.title = 'stale title'
       p2.save
@@ -127,15 +135,15 @@ class VersionedTest &lt; Test::Unit::TestCase
   end
 
   def test_version_if_condition
-    p = Page.create :title =&gt; &quot;title&quot;
+    p = Page.create! :title =&gt; &quot;title&quot;
     assert_equal 1, p.version
-    
+
     Page.feeling_good = false
     p.save
     assert_equal 1, p.version
     Page.feeling_good = true
   end
-  
+
   def test_version_if_condition2
     # set new if condition
     Page.class_eval do
@@ -143,87 +151,86 @@ class VersionedTest &lt; Test::Unit::TestCase
       alias_method :old_feeling_good, :feeling_good?
       alias_method :feeling_good?, :new_feeling_good
     end
-    
-    p = Page.create :title =&gt; &quot;title&quot;
+
+    p = Page.create! :title =&gt; &quot;title&quot;
     assert_equal 1, p.version # version does not increment
-    assert_equal 1, p.versions(true).size
-    
+    assert_equal 1, p.versions.count
+
     p.update_attributes(:title =&gt; 'new title')
     assert_equal 1, p.version # version does not increment
-    assert_equal 1, p.versions(true).size
-    
+    assert_equal 1, p.versions.count
+
     p.update_attributes(:title =&gt; 'a title')
     assert_equal 2, p.version
-    assert_equal 2, p.versions(true).size
-    
+    assert_equal 2, p.versions.count
+
     # reset original if condition
     Page.class_eval { alias_method :feeling_good?, :old_feeling_good }
   end
-  
+
   def test_version_if_condition_with_block
     # set new if condition
     old_condition = Page.version_condition
     Page.version_condition = Proc.new { |page| page.title[0..0] == 'b' }
-    
-    p = Page.create :title =&gt; &quot;title&quot;
+
+    p = Page.create! :title =&gt; &quot;title&quot;
     assert_equal 1, p.version # version does not increment
-    assert_equal 1, p.versions(true).size
-    
+    assert_equal 1, p.versions.count
+
     p.update_attributes(:title =&gt; 'a title')
     assert_equal 1, p.version # version does not increment
-    assert_equal 1, p.versions(true).size
-    
+    assert_equal 1, p.versions.count
+
     p.update_attributes(:title =&gt; 'b title')
     assert_equal 2, p.version
-    assert_equal 2, p.versions(true).size
-    
+    assert_equal 2, p.versions.count
+
     # reset original if condition
     Page.version_condition = old_condition
   end
 
   def test_version_no_limit
-    p = Page.create :title =&gt; &quot;title&quot;, :body =&gt; 'first body'
+    p = Page.create! :title =&gt; &quot;title&quot;, :body =&gt; 'first body'
     p.save
     p.save
     5.times do |i|
-      assert_page_title p, i
+      p.title = &quot;title#{i}&quot;
+      p.save
+      assert_equal &quot;title#{i}&quot;, p.title
+      assert_equal (i+2), p.version
     end
   end
 
   def test_version_max_limit
-    p = LockedPage.create :title =&gt; &quot;title&quot;
+    p = LockedPage.create! :title =&gt; &quot;title&quot;
     p.update_attributes(:title =&gt; &quot;title1&quot;)
     p.update_attributes(:title =&gt; &quot;title2&quot;)
     5.times do |i|
-      assert_page_title p, i, :lock_version
+      p.title = &quot;title#{i}&quot;
+      p.save
+      assert_equal &quot;title#{i}&quot;, p.title
+      assert_equal (i+4), p.lock_version
       assert p.versions(true).size &lt;= 2, &quot;locked version can only store 2 versions&quot;
     end
   end
-  
-  def test_track_changed_attributes_default_value
-    assert !Page.track_changed_attributes
-    assert LockedPage.track_changed_attributes
-    assert SpecialLockedPage.track_changed_attributes
-  end
-  
-  def test_version_order
-    assert_equal 23, pages(:welcome).versions.first.version
-    assert_equal 24, pages(:welcome).versions.last.version
-    assert_equal 23, pages(:welcome).find_versions.first.version
-    assert_equal 24, pages(:welcome).find_versions.last.version
-  end
-  
-  def test_track_changed_attributes    
-    p = LockedPage.create :title =&gt; &quot;title&quot;
+
+  def test_track_altered_attributes_default_value
+    assert !Page.track_altered_attributes
+    assert LockedPage.track_altered_attributes
+    assert SpecialLockedPage.track_altered_attributes
+  end
+
+  def test_track_altered_attributes
+    p = LockedPage.create! :title =&gt; &quot;title&quot;
     assert_equal 1, p.lock_version
     assert_equal 1, p.versions(true).size
-    
-    p.title = 'title'
+
+    p.body = 'whoa'
     assert !p.save_version?
     p.save
     assert_equal 2, p.lock_version # still increments version because of optimistic locking
     assert_equal 1, p.versions(true).size
-    
+
     p.title = 'updated title'
     assert p.save_version?
     p.save
@@ -236,27 +243,18 @@ class VersionedTest &lt; Test::Unit::TestCase
     assert_equal 4, p.lock_version
     assert_equal 2, p.versions(true).size # version 1 deleted
   end
-    
-  def assert_page_title(p, i, version_field = :version)
-    p.title = &quot;title#{i}&quot;
-    p.save
-    assert_equal &quot;title#{i}&quot;, p.title
-    assert_equal (i+4), p.send(version_field)
-  end
-  
+
   def test_find_versions
-    assert_equal 2, locked_pages(:welcome).versions.size
-    assert_equal 1, locked_pages(:welcome).find_versions(:conditions =&gt; ['title LIKE ?', '%weblog%']).length
-    assert_equal 2, locked_pages(:welcome).find_versions(:conditions =&gt; ['title LIKE ?', '%web%']).length
-    assert_equal 0, locked_pages(:thinking).find_versions(:conditions =&gt; ['title LIKE ?', '%web%']).length
-    assert_equal 2, locked_pages(:welcome).find_versions.length
+    assert_equal 1, locked_pages(:welcome).versions.find(:all, :conditions =&gt; ['title LIKE ?', '%weblog%']).size
   end
-  
+
+  def test_find_version
+    assert_equal page_versions(:welcome_1), pages(:welcome).versions.find_by_version(23)
+  end
+
   def test_with_sequence
     assert_equal 'widgets_seq', Widget.versioned_class.sequence_name
-    Widget.create :name =&gt; 'new widget'
-    Widget.create :name =&gt; 'new widget'
-    Widget.create :name =&gt; 'new widget'
+    3.times { Widget.create! :name =&gt; 'new widget' }
     assert_equal 3, Widget.count
     assert_equal 3, Widget.versioned_class.count
   end
@@ -268,26 +266,25 @@ class VersionedTest &lt; Test::Unit::TestCase
   def test_has_many_through_with_custom_association
     assert_equal [authors(:caged), authors(:mly)], pages(:welcome).revisors
   end
-  
+
   def test_referential_integrity
     pages(:welcome).destroy
     assert_equal 0, Page.count
     assert_equal 0, Page::Version.count
   end
-  
+
   def test_association_options
     association = Page.reflect_on_association(:versions)
     options = association.options
     assert_equal :delete_all, options[:dependent]
-    assert_equal 'version', options[:order]
-    
+
     association = Widget.reflect_on_association(:versions)
     options = association.options
-    assert_nil options[:dependent]
+    assert_equal :nullify, options[:dependent]
     assert_equal 'version desc', options[:order]
     assert_equal 'widget_id', options[:foreign_key]
-    
-    widget = Widget.create :name =&gt; 'new widget'
+
+    widget = Widget.create! :name =&gt; 'new widget'
     assert_equal 1, Widget.count
     assert_equal 1, Widget.versioned_class.count
     widget.destroy
@@ -300,14 +297,56 @@ class VersionedTest &lt; Test::Unit::TestCase
     page_version = page.versions.last
     assert_equal page, page_version.page
   end
-  
-  def test_unchanged_attributes
-    landmarks(:washington).attributes = landmarks(:washington).attributes
+
+  def test_unaltered_attributes
+    landmarks(:washington).attributes = landmarks(:washington).attributes.except(&quot;id&quot;)
     assert !landmarks(:washington).changed?
   end
-  
+
   def test_unchanged_string_attributes
-    landmarks(:washington).attributes = landmarks(:washington).attributes.inject({}) { |params, (key, value)| params.update key =&gt; value.to_s }
+    landmarks(:washington).attributes = landmarks(:washington).attributes.except(&quot;id&quot;).inject({}) { |params, (key, value)| params.update(key =&gt; value.to_s) }
     assert !landmarks(:washington).changed?
   end
-end
+
+  def test_should_find_earliest_version
+    assert_equal page_versions(:welcome_1), pages(:welcome).versions.earliest
+  end
+
+  def test_should_find_latest_version
+    assert_equal page_versions(:welcome_2), pages(:welcome).versions.latest
+  end
+
+  def test_should_find_previous_version
+    assert_equal page_versions(:welcome_1), page_versions(:welcome_2).previous
+    assert_equal page_versions(:welcome_1), pages(:welcome).versions.before(page_versions(:welcome_2))
+  end
+
+  def test_should_find_next_version
+    assert_equal page_versions(:welcome_2), page_versions(:welcome_1).next
+    assert_equal page_versions(:welcome_2), pages(:welcome).versions.after(page_versions(:welcome_1))
+  end
+
+  def test_should_find_version_count
+    assert_equal 2, pages(:welcome).versions.size
+  end
+
+  def test_if_changed_creates_version_if_a_listed_column_is_changed
+    landmarks(:washington).name = &quot;Washington&quot;
+    assert landmarks(:washington).changed?
+    assert landmarks(:washington).altered?
+  end
+
+  def test_if_changed_creates_version_if_all_listed_columns_are_changed
+    landmarks(:washington).name = &quot;Washington&quot;
+    landmarks(:washington).latitude = 1.0
+    landmarks(:washington).longitude = 1.0
+    assert landmarks(:washington).changed?
+    assert landmarks(:washington).altered?
+  end
+
+  def test_if_changed_does_not_create_new_version_if_unlisted_column_is_changed
+    landmarks(:washington).doesnt_trigger_version = &quot;This should not trigger version&quot;
+    assert landmarks(:washington).changed?
+    assert !landmarks(:washington).altered?
+  end
+end
\ No newline at end of file</diff>
      <filename>vendor/plugins/acts_as_versioned/test/versioned_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1e02b1e4bf2bebb9b960168ae93e48c74bc3dc15</id>
    </parent>
  </parents>
  <author>
    <name>Eric Kidd</name>
    <email>git@randomhacks.net</email>
  </author>
  <url>http://github.com/emk/mephisto/commit/79a460e1d6a65d326dbb5739324d42ce4624bd70</url>
  <id>79a460e1d6a65d326dbb5739324d42ce4624bd70</id>
  <committed-date>2008-12-04T14:54:41-08:00</committed-date>
  <authored-date>2008-12-04T14:54:41-08:00</authored-date>
  <message>Upgrade to latest acts_as_versioned

This eliminates some API conflicts with Rails 2.2 and gets more of the
tests passing.  This is version c310d2805ed243fd7587afcc5cec1bbbb9198947
from git://github.com/technoweenie/acts_as_versioned.git .</message>
  <tree>68d5dc2c4bb3ea7da59f5f196e676f4caa8354df</tree>
  <committer>
    <name>Eric Kidd</name>
    <email>git@randomhacks.net</email>
  </committer>
</commit>
