<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -93,7 +93,7 @@ module PermalinkFu
       class &lt;&lt; base
         alias_method :define_attribute_methods_without_permalinks, :define_attribute_methods
         alias_method :define_attribute_methods, :define_attribute_methods_with_permalinks
-      end
+      end unless base.respond_to?(:define_attribute_methods_without_permalinks)
     end
 
     def define_attribute_methods_with_permalinks
@@ -158,7 +158,9 @@ module PermalinkFu
 
   private
     def should_create_permalink?
-      if self.class.permalink_options[:if]
+      if self.class.permalink_field.blank?
+        false
+      elsif self.class.permalink_options[:if]
         evaluate_method(self.class.permalink_options[:if])
       elsif self.class.permalink_options[:unless]
         !evaluate_method(self.class.permalink_options[:unless])</diff>
      <filename>lib/permalink_fu.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,6 +12,37 @@ class PermalinkFuTest &lt; Test::Unit::TestCase
 
   @@extra = { 'some-)()()-ExtRa!/// .data==?&gt;    to \/\/test'.freeze =&gt; 'some-extra-data-to-test'.freeze }
 
+  def test_basemodel
+    @m = BaseModel.new
+    assert @m.valid?
+    assert_equal @m.id, nil
+    assert_equal @m.title, nil
+    assert_equal @m.permalink, nil
+    assert_equal @m.extra, nil
+    assert_equal @m.foo, nil
+  end
+
+  def test_set_new_permalink_attributes_on_sub_class
+    @m = ClassModel.new
+    @m.title = 'foo'
+    @m.extra = 'bar'
+    assert @m.valid?
+    assert_equal @m.permalink, 'foo'
+    
+    @m = SubClassHasPermalinkModel.new
+    @m.title = 'foo'
+    @m.extra = 'bar'
+    assert @m.valid?
+    assert_equal @m.permalink, 'foo-bar'
+  end
+  
+  def test_should_not_inherit_permalink_attributes
+    @m = SubClassNoPermalinkModel.new
+    @m.title = 'foo'
+    assert @m.valid?
+    assert_equal @m.permalink, nil
+  end
+
   def test_should_escape_permalinks
     @@samples.each do |from, to|
       assert_equal to, PermalinkFu.escape(from)</diff>
      <filename>test/permalink_fu_test.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ begin
   require 'ruby-debug'
   Debugger.start
 rescue LoadError
-  puts &quot;no ruby debugger&quot;
+  # no ruby debugger
 end
 
 gem 'activerecord'
@@ -18,7 +18,7 @@ class BaseModel &lt; ActiveRecord::Base
   @@columns ||= []
   
   def self.column(name, sql_type = nil, default = nil, null = true)
-    columns &lt;&lt; ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type.to_s, null)
+    columns &lt;&lt; ActiveRecord::ConnectionAdapters::Column.new(name.to_s, default, sql_type, null)
   end
   
   def self.exists?(*args)
@@ -33,6 +33,17 @@ class BaseModel &lt; ActiveRecord::Base
   
 end
 
+class ClassModel &lt; BaseModel
+  has_permalink :title
+end
+
+class SubClassHasPermalinkModel &lt; ClassModel
+  has_permalink [:title, :extra]
+end
+
+class SubClassNoPermalinkModel &lt; ClassModel
+end
+
 class MockModel &lt; BaseModel
   def self.exists?(conditions)
     if conditions[1] == 'foo'   || conditions[1] == 'bar' || </diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e44a9ffe38f4f0904379d63d7d29f83f73e396d7</id>
    </parent>
  </parents>
  <author>
    <name>Adam Salter</name>
    <email>adam@codebright.net</email>
  </author>
  <url>http://github.com/technoweenie/permalink_fu/commit/8a19c9e01eddd0f04a6b2ba8e1c8019c3f904c15</url>
  <id>8a19c9e01eddd0f04a6b2ba8e1c8019c3f904c15</id>
  <committed-date>2009-08-27T05:14:54-07:00</committed-date>
  <authored-date>2009-08-27T05:14:54-07:00</authored-date>
  <message>- update to allow subclassing permalink models</message>
  <tree>ed36152b21c395c7b0328dee760866c2d68d9bf2</tree>
  <committer>
    <name>Adam Salter</name>
    <email>adam@codebright.net</email>
  </committer>
</commit>
