<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/controllers/feeds_controller.rb</filename>
    </added>
    <added>
      <filename>app/helpers/feeds_helper.rb</filename>
    </added>
    <added>
      <filename>app/models/feed.rb</filename>
    </added>
    <added>
      <filename>app/views/feeds/edit.html.erb</filename>
    </added>
    <added>
      <filename>app/views/feeds/index.html.erb</filename>
    </added>
    <added>
      <filename>app/views/feeds/new.html.erb</filename>
    </added>
    <added>
      <filename>app/views/feeds/show.html.erb</filename>
    </added>
    <added>
      <filename>app/views/layouts/feeds.html.erb</filename>
    </added>
    <added>
      <filename>config/initializers/feedable.rb</filename>
    </added>
    <added>
      <filename>db/migrate/004_create_feeds.rb</filename>
    </added>
    <added>
      <filename>test/fixtures/feeds.yml</filename>
    </added>
    <added>
      <filename>test/functional/feeds_controller_test.rb</filename>
    </added>
    <added>
      <filename>test/mocks/animoto_news.rss</filename>
    </added>
    <added>
      <filename>test/mocks/daringfireball.xml</filename>
    </added>
    <added>
      <filename>test/mocks/dhh.rss</filename>
    </added>
    <added>
      <filename>test/unit/feed_test.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -2,7 +2,9 @@ class Post &lt; ActiveRecord::Base
   
   has_many :comments, :as =&gt; :commentable
     
-  validates_presence_of :user_id, :permalink
+  validates_presence_of :permalink  
+  validates_presence_of :user_id, :unless =&gt; :feed_id
+  validates_presence_of :feed_id, :unless =&gt; :user_id
   
   def self.per_page; 5; end
   </diff>
      <filename>app/models/post.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,6 @@
 ActionController::Routing::Routes.draw do |map|
+  map.resources :feeds
+
   
   map.resources :posts
   map.resources :users</diff>
      <filename>config/routes.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,9 +7,9 @@ class CreatePosts &lt; ActiveRecord::Migration
       t.string :cite
       t.string :type
       t.integer :user_id
+      t.integer :feed_id
       t.string :lang
       t.integer :comment_counter
-
       t.timestamps
     end
   end</diff>
      <filename>db/migrate/002_create_posts.rb</filename>
    </modified>
    <modified>
      <diff>@@ -9,7 +9,7 @@
 #
 # It's strongly recommended to check this file into your version control system.
 
-ActiveRecord::Schema.define(:version =&gt; 3) do
+ActiveRecord::Schema.define(:version =&gt; 4) do
 
   create_table &quot;comments&quot;, :force =&gt; true do |t|
     t.integer  &quot;commentable_id&quot;
@@ -23,6 +23,18 @@ ActiveRecord::Schema.define(:version =&gt; 3) do
     t.datetime &quot;updated_at&quot;
   end
 
+  create_table &quot;feeds&quot;, :force =&gt; true do |t|
+    t.datetime &quot;last_updated_at&quot;
+    t.string   &quot;title&quot;
+    t.string   &quot;url&quot;
+    t.text     &quot;description&quot;
+    t.string   &quot;uri&quot;
+    t.integer  &quot;user_id&quot;
+    t.string   &quot;type&quot;
+    t.datetime &quot;created_at&quot;
+    t.datetime &quot;updated_at&quot;
+  end
+
   create_table &quot;posts&quot;, :force =&gt; true do |t|
     t.string   &quot;permalink&quot;
     t.string   &quot;header&quot;
@@ -30,6 +42,7 @@ ActiveRecord::Schema.define(:version =&gt; 3) do
     t.string   &quot;cite&quot;
     t.string   &quot;type&quot;
     t.integer  &quot;user_id&quot;
+    t.integer  &quot;feed_id&quot;
     t.string   &quot;lang&quot;
     t.integer  &quot;comment_counter&quot;
     t.datetime &quot;created_at&quot;</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -25,5 +25,27 @@ end
 
 class Feed &lt; ActiveRecord::Base
   # Attributes:
-  # url:string doctype:string 
-end
\ No newline at end of file
+  # last_updated_at:datetime title:string url:string description:text uri:string user_id:integer type:string
+  
+  def self.inherited(subclass)
+    subclass.send :include, Aintablog::Feedable
+  end
+  
+  def poll!
+    
+  end
+  
+end
+
+class Twitter &lt; Feed
+  entries_become :tweets
+end
+
+class Blog &lt; Feed
+  entries_become :articles
+end
+
+class Flickr &lt; Feed
+  entries_become :pictures
+end
+</diff>
      <filename>doc/blog_plans.rb</filename>
    </modified>
    <modified>
      <diff>@@ -34,6 +34,8 @@ class Test::Unit::TestCase
   # Note: You'll currently still have to declare fixtures explicitly in integration tests
   # -- they do not yet inherit this setting
   fixtures :all
+  
+  MOCK_ROOT = File.dirname(__FILE__) + '/mocks' unless defined?(MOCK_ROOT)
 
   # Add more helper methods to be used by all tests here...
   include AuthenticatedTestHelper</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -8,16 +8,32 @@ class PostTest &lt; ActiveSupport::TestCase
     end
   end
   
-  def test_should_require_user_id
+  def test_should_require_user_id_sans_feed_id
     assert_no_difference 'Post.count' do
+      post = create_post({ :user_id =&gt; nil, :feed_id =&gt; nil })
+    end
+  end
+  
+  def test_should_create_with_only_user_id
+    assert_difference 'Post.count' do
+      post = create_post( :feed_id =&gt; nil )
+    end
+  end
+  
+  def test_should_create_with_only_feed_id
+    assert_difference 'Post.count' do
       post = create_post( :user_id =&gt; nil )
-      assert ! post.valid?, post.to_yaml
     end
   end
   
+  def test_should_override_to_param
+    post = create_post
+    assert_equal post.permalink, post.to_param
+  end
+  
 protected
 
   def create_post(options={})
-    Post.create({ :header =&gt; 'A name', :content =&gt; 'Some content', :type =&gt; 'Article', :user_id =&gt; users(:quentin).id, :permalink =&gt; 'ok' }.merge(options))
+    Post.create({ :header =&gt; 'A name', :content =&gt; 'Some content', :user_id =&gt; users(:quentin).id, :feed_id =&gt; feeds(:one).id, :permalink =&gt; 'ok' }.merge(options))
   end
 end</diff>
      <filename>test/unit/post_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5263f1158e7608d0ddc3b0cb656e0065f5bdc1b4</id>
    </parent>
  </parents>
  <author>
    <name>Pat Nakajima</name>
    <email>patnakajima@gmail.com</email>
  </author>
  <url>http://github.com/nakajima/aintablog/commit/4c6d37fb19b889e451f026b6ed3bd3283bbe7190</url>
  <id>4c6d37fb19b889e451f026b6ed3bd3283bbe7190</id>
  <committed-date>2008-03-11T15:07:24-07:00</committed-date>
  <authored-date>2008-03-11T15:07:24-07:00</authored-date>
  <message>added feeds</message>
  <tree>867ad34da7ebb39799deddd8450950f33886a483</tree>
  <committer>
    <name>Pat Nakajima</name>
    <email>patnakajima@gmail.com</email>
  </committer>
</commit>
