<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>test/cached_slug_test.rb</filename>
    </added>
    <added>
      <filename>test/models/city.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -161,7 +161,7 @@ generating URLs. For that, you need a column on your model:
 Then, you can enable cached slugs:
 
   class User &lt; ActiveRecord::Base
-    has_friendly_id :name, :use_slug =&gt; true, :cached_column =&gt; 'cached_slug'
+    has_friendly_id :name, :use_slug =&gt; true, :cache_column =&gt; 'cached_slug'
   end
 
 Important: if you activate this option on a table with already existing slugs,</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -55,7 +55,7 @@ module FriendlyId::SluggableInstanceMethods
   # id.
   def slug(reload = false)
     @most_recent_slug = nil if reload
-    @most_recent_slug ||= slugs.first
+    @most_recent_slug ||= slugs.first(:order =&gt; &quot;id DESC&quot;)
   end
 
   # Returns the friendly id, or if none is available, the numeric id.
@@ -120,7 +120,8 @@ private
       slugs.find(:all, :conditions =&gt; {:name =&gt; slug_text, :scope =&gt; scope}).each { |s| s.destroy }
       slug = slugs.build slug_attributes
       if cache = friendly_id_options[:cache_column]
-        update_attribute(cache, slug.to_friendly_id) unless send(cache) == slug.to_friendly_id
+        new_slug = slug.to_friendly_id
+        send(&quot;#{cache}=&quot;, new_slug) unless send(cache) == new_slug
       end
       slug
     end</diff>
      <filename>lib/friendly_id/sluggable_instance_methods.rb</filename>
    </modified>
    <modified>
      <diff>@@ -40,6 +40,11 @@ ActiveRecord::Schema.define(:version =&gt; 1) do
     t.column &quot;event_date&quot;, &quot;datetime&quot;
   end
 
+  create_table &quot;cities&quot;, :force =&gt; true do |t|
+    t.column &quot;name&quot;, &quot;string&quot;
+    t.column &quot;cached_slug&quot;, &quot;string&quot;
+  end
+
   create_table &quot;slugs&quot;, :force =&gt; true do |t|
     t.column &quot;name&quot;, &quot;string&quot;
     t.column &quot;sluggable_id&quot;, &quot;integer&quot;</diff>
      <filename>test/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,8 +23,9 @@ require 'models/book'
 require 'models/novel'
 require 'models/thing'
 require 'models/event'
+require 'models/city'
 
 ActiveRecord::Base.establish_connection :adapter =&gt; &quot;sqlite3&quot;, :database =&gt; &quot;:memory:&quot;
 silence_stream(STDOUT) do
   load(File.dirname(__FILE__) + &quot;/schema.rb&quot;)
-end
\ No newline at end of file
+end</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>8ef86f69e47d6ff14d8ce2e34e17e0958098c09b</id>
    </parent>
  </parents>
  <author>
    <name>Bruno Michel</name>
    <email>bmichel@menfin.info</email>
  </author>
  <url>http://github.com/kakra/friendly_id/commit/68719022fc0a979710ef569d84f8a7e5d62203b3</url>
  <id>68719022fc0a979710ef569d84f8a7e5d62203b3</id>
  <committed-date>2009-09-22T16:09:19-07:00</committed-date>
  <authored-date>2009-09-22T16:09:19-07:00</authored-date>
  <message>Added some unit tests</message>
  <tree>d42fcd8f436726dfddc5beb74c1093cee6d6f511</tree>
  <committer>
    <name>Bruno Michel</name>
    <email>bmichel@menfin.info</email>
  </committer>
</commit>
