<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/001_create_rating_values.rb</filename>
    </added>
    <added>
      <filename>db/migrate/002_create_ratings.rb</filename>
    </added>
    <added>
      <filename>test/app_root/db/migrate/003_migrate_has_ratings_to_version_2.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,5 +1,8 @@
 == master
 
+* Replace acts_as_enumeration with enumerate_by
+* Add dependency on Rails 2.3
+
 == 0.2.0 / 2008-12-14
 
 * Remove the PluginAWeek namespace</diff>
      <filename>CHANGELOG.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-Copyright (c) 2006-2008 Aaron Pfeifer
+Copyright (c) 2006-2009 Aaron Pfeifer
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the</diff>
      <filename>LICENSE</filename>
    </modified>
    <modified>
      <diff>@@ -56,6 +56,5 @@ To run against a specific version of Rails:
 
 == Dependencies
 
-* Rails 2.1 or later
-* acts_as_enumeration[http://github.com/pluginaweek/acts_as_enumeration]
-* plugins_plus[http://github.com/pluginaweek/plugins_plugins] (optional if app files are copied to your project tree)
+* Rails 2.3 or later
+* enumerate_by[http://github.com/pluginaweek/enumerate_by]</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s|
   s.require_path      = 'lib'
   s.has_rdoc          = true
   s.test_files        = Dir['test/**/*_test.rb']
-  s.add_dependency    'acts_as_enumeration', '&gt;= 0.1.0'
+  s.add_dependency    'enumerate_by', '&gt;= 0.4.0'
   
   s.author            = 'Aaron Pfeifer'
   s.email             = 'aaron@pluginaweek.org'</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -6,16 +6,10 @@
 # *Note* that the value does not represent the actual integer value, but rather
 # the enumeration record in the RatingValue model.
 class Rating &lt; ActiveRecord::Base
-  belongs_to  :rater,
-                :polymorphic =&gt; true
-  belongs_to  :ratable,
-                :polymorphic =&gt; true
-  belongs_to  :value,
-                :class_name =&gt; 'RatingValue'
+  belongs_to :rater, :polymorphic =&gt; true
+  belongs_to :ratable, :polymorphic =&gt; true
+  belongs_to :value, :class_name =&gt; 'RatingValue'
   
-  validates_presence_of :rater_id,
-                        :rater_type,
-                        :ratable_id,
-                        :ratable_type,
+  validates_presence_of :rater_id, :rater_type, :ratable_id, :ratable_type,
                         :value_id
 end</diff>
      <filename>app/models/rating.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-# The type of rating that can be assigned.  This is an enumeration which consists
-# of a pre-determined set of possible rating values.  Each value has the following
-# attributes:
+# The type of rating that can be assigned.  This is an enumeration which
+# consists of a pre-determined set of possible rating values.  Each value has
+# the following attributes:
 # * +name+ - The actual name to refer to the value as
 # * +value+ - The numeric value of the rating (higher is better)
 # 
@@ -9,12 +9,9 @@
 #   RatingValue['poor']       # =&gt; #&lt;RatingValue id: 1, name: &quot;poor&quot;, value: 1&gt;
 #   RatingValue['excellent']  # =&gt; #&lt;RatingValue id: 5, name: &quot;excellent&quot;, value: 5&gt;
 class RatingValue &lt; ActiveRecord::Base
-  acts_as_enumeration
+  enumerate_by :name
   
-  column :value, :integer
-  
-  has_many  :ratings,
-              :foreign_key =&gt; 'value_id'
+  has_many :ratings, :foreign_key =&gt; 'value_id'
   
   validates_presence_of :value
   
@@ -24,9 +21,11 @@ class RatingValue &lt; ActiveRecord::Base
   end
   
   # Represent the possible values for ratings
-  create :id =&gt; 1, :name =&gt; 'poor', :value =&gt; 1
-  create :id =&gt; 2, :name =&gt; 'below_average', :value =&gt; 2
-  create :id =&gt; 3, :name =&gt; 'average', :value =&gt; 3
-  create :id =&gt; 4, :name =&gt; 'above_average', :value =&gt; 4
-  create :id =&gt; 5, :name =&gt; 'excellent', :value =&gt; 5
+  bootstrap(
+    {:id =&gt; 1, :name =&gt; 'poor', :value =&gt; 1},
+    {:id =&gt; 2, :name =&gt; 'below_average', :value =&gt; 2},
+    {:id =&gt; 3, :name =&gt; 'average', :value =&gt; 3},
+    {:id =&gt; 4, :name =&gt; 'above_average', :value =&gt; 4},
+    {:id =&gt; 5, :name =&gt; 'excellent', :value =&gt; 5}
+  )
 end</diff>
      <filename>app/models/rating_value.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,8 +5,8 @@ module HasRatings
     # * +ratings+ - All ratings associated with the current record
     # 
     # This association assumes that it is being created on the +ratable+
-    # model.  If you want to create an association on the +rater+ model, it will
-    # have to be created manually like so:
+    # model.  If you want to create an association on the +rater+ model,
+    # it will have to be created manually like so:
     # 
     #   has_many :ratings, :as =&gt; :rater
     # 
@@ -21,9 +21,7 @@ module HasRatings
     #   video.ratings.create(:rater =&gt; user, :value =&gt; 'excellent')
     #   video.ratings.average   # =&gt; 5
     def has_ratings
-      has_many  :ratings,
-                  :as =&gt; :ratable,
-                  :extend =&gt; RatingExtension
+      has_many :ratings, :as =&gt; :ratable, :extend =&gt; RatingExtension
     end
   end
   
@@ -34,7 +32,7 @@ module HasRatings
     # For example,
     # 
     #   video = Video.find_by_name('The Shawshank Redemption')
-    #   video.ratings.map {|rating| rating.value.value}   # =&gt; [4, 5, 5]
+    #   video.ratings.map {|rating| rating.value.to_i}    # =&gt; [4, 5, 5]
     #   video.ratings.average                             # =&gt; 4.67
     def average
       if empty?</diff>
      <filename>lib/has_ratings.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,9 +1,9 @@
 require 'config/boot'
-require &quot;#{File.dirname(__FILE__)}/../../../../plugins_plus/boot&quot;
 
 Rails::Initializer.run do |config|
   config.plugin_paths &lt;&lt; '..'
-  config.plugins = %w(plugins_plus acts_as_enumeration has_ratings)
+  config.plugins = %w(enumerate_by has_ratings)
   config.cache_classes = false
   config.whiny_nils = true
+  config.action_controller.session = {:key =&gt; 'rails_session', :secret =&gt; 'd229e4d22437432705ab3985d4d246'}
 end</diff>
      <filename>test/app_root/config/environment.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 class CreateVideos &lt; ActiveRecord::Migration
   def self.up
     create_table :videos do |t|
-      t.string :name
+      t.string :name, :null =&gt; false
     end
   end
   </diff>
      <filename>test/app_root/db/migrate/002_create_videos.rb</filename>
    </modified>
    <modified>
      <diff>@@ -36,17 +36,13 @@ module Factory
   build Rating do |attributes|
     attributes[:ratable] = create_video unless attributes.include?(:ratable)
     attributes[:rater] = create_user unless attributes.include?(:rater)
-    
-    attributes.reverse_merge!(
-      :value =&gt; 'average'
-    )
+    attributes[:value] = create_rating_value unless attributes.include?(:value)
   end
   
   build RatingValue do |attributes|
     attributes.reverse_merge!(
-      :id =&gt; 6,
       :name =&gt; 'awesome',
-      :value =&gt; 6
+      :value =&gt; 10
     )
   end
   </diff>
      <filename>test/factory.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
 
-class VideoTest &lt; Test::Unit::TestCase
+class VideoTest &lt; ActiveRecord::TestCase
   def setup
     @video = create_video
   end
@@ -14,7 +14,7 @@ class VideoTest &lt; Test::Unit::TestCase
   end
 end
 
-class VideoWithRatingsTest &lt; Test::Unit::TestCase
+class VideoWithRatingsTest &lt; ActiveRecord::TestCase
   def setup
     @video = create_video
     
@@ -32,7 +32,7 @@ class VideoWithRatingsTest &lt; Test::Unit::TestCase
   end
 end
 
-class VideoWithRoundedAverageTest &lt; Test::Unit::TestCase
+class VideoWithRoundedAverageTest &lt; ActiveRecord::TestCase
   def setup
     @video = create_video
     </diff>
      <filename>test/functional/has_ratings_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,3 +11,5 @@ require File.expand_path(&quot;#{File.dirname(__FILE__)}/factory&quot;)
 Test::Unit::TestCase.class_eval do
   include Factory
 end
+
+RatingValue.enumerator_cache = nil</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
 
-class RatingByDefaultTest &lt; Test::Unit::TestCase
+class RatingByDefaultTest &lt; ActiveRecord::TestCase
   def setup
     @rating = Rating.new
   end
@@ -22,11 +22,11 @@ class RatingByDefaultTest &lt; Test::Unit::TestCase
   end
   
   def test_should_not_have_a_value
-    assert_nil @rating.value
+    assert_nil @rating.value_id
   end
 end
 
-class RatingTest &lt; Test::Unit::TestCase
+class RatingTest &lt; ActiveRecord::TestCase
   def test_should_be_valid_with_a_valid_set_of_attributes
     rating = new_rating
     assert rating.valid?
@@ -61,27 +61,9 @@ class RatingTest &lt; Test::Unit::TestCase
     assert !rating.valid?
     assert rating.errors.invalid?(:value_id)
   end
-  
-  def test_should_protect_attributes_from_mass_assignment
-    rating = Rating.new(
-      :id =&gt; 1,
-      :ratable_id =&gt; 1,
-      :ratable_type =&gt; 'Video',
-      :rater_id =&gt; 1,
-      :rater_type =&gt; 'User',
-      :value_id =&gt; 2
-    )
-    
-    assert_nil rating.id
-    assert_equal 1, rating.ratable_id
-    assert_equal 'Video', rating.ratable_type
-    assert_equal 1, rating.rater_id
-    assert_equal 'User', rating.rater_type
-    assert_equal 2, rating.value_id
-  end
 end
 
-class RatingAfterBeingCreatedTest &lt; Test::Unit::TestCase
+class RatingAfterBeingCreatedTest &lt; ActiveRecord::TestCase
   def setup
     @rating = create_rating
   end</diff>
      <filename>test/unit/rating_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,16 +1,12 @@
 require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
 
-class RatingValueByDefaultTest &lt; Test::Unit::TestCase
+class RatingValueByDefaultTest &lt; ActiveRecord::TestCase
   def setup
     @rating_value = RatingValue.new
   end
   
-  def test_should_not_have_an_id
-    assert_nil @rating_value.id
-  end
-  
   def test_should_not_have_a_name
-    assert_nil @rating_value.name
+    assert @rating_value.name.blank?
   end
   
   def test_should_not_have_a_value
@@ -18,7 +14,7 @@ class RatingValueByDefaultTest &lt; Test::Unit::TestCase
   end
 end
 
-class RatingValueTest &lt; Test::Unit::TestCase
+class RatingValueTest &lt; ActiveRecord::TestCase
   def test_should_be_valid_with_a_valid_set_of_attributes
     rating_value = new_rating_value
     assert rating_value.valid?
@@ -40,23 +36,11 @@ class RatingValueTest &lt; Test::Unit::TestCase
     rating_value = new_rating_value(:value =&gt; 1)
     assert_equal 1, rating_value.to_i
   end
-  
-  def test_should_protect_attributes_from_mass_assignment
-    rating_value = RatingValue.new(
-      :id =&gt; 6,
-      :name =&gt; 'awesome',
-      :value =&gt; 6
-    )
-    
-    assert_equal 6, rating_value.id
-    assert_equal 'awesome', rating_value.name
-    assert_equal 6, rating_value.value
-  end
 end
 
-class RatingValueAfterBeingCreatedTest &lt; Test::Unit::TestCase
+class RatingValueAfterBeingCreatedTest &lt; ActiveRecord::TestCase
   def setup
-    @rating_value = RatingValue['poor']
+    @rating_value = create_rating_value
   end
   
   def test_should_not_have_any_ratings
@@ -64,9 +48,9 @@ class RatingValueAfterBeingCreatedTest &lt; Test::Unit::TestCase
   end
 end
 
-class RatingValueWithRatingsTest &lt; Test::Unit::TestCase
+class RatingValueWithRatingsTest &lt; ActiveRecord::TestCase
   def setup
-    @rating_value = RatingValue['poor']
+    @rating_value = create_rating_value
     @poor_rating = create_rating(:value =&gt; @rating_value)
     @second_poor_rating = create_rating(:value =&gt; @rating_value)
   end</diff>
      <filename>test/unit/rating_value_test.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>db/migrate/001_create_ratings.rb</filename>
    </removed>
    <removed>
      <filename>test/app_root/db/migrate/003_migrate_has_ratings_to_version_1.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>14d177da7c6031eda6a36ab5ad243d63a2c64ab4</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </author>
  <url>http://github.com/pluginaweek/has_ratings/commit/2221ffab0bf7b54c11ed343d54958e1d1fff67a3</url>
  <id>2221ffab0bf7b54c11ed343d54958e1d1fff67a3</id>
  <committed-date>2009-04-27T18:07:23-07:00</committed-date>
  <authored-date>2009-04-27T18:07:23-07:00</authored-date>
  <message>Add dependency on Rails 2.3
Replace acts_as_enumeration with enumerate_by</message>
  <tree>96418a71a55ef9701764e8e1cf04c17352fadc45</tree>
  <committer>
    <name>Aaron Pfeifer</name>
    <email>aaron.pfeifer@gmail.com</email>
  </committer>
</commit>
