<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>db/migrate/20090609094313_add_contributed_at_to_groups.rb</filename>
    </added>
    <added>
      <filename>test/unit/sample_feeds/polytechnic.rss</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,5 @@
 class HomeController &lt; ApplicationController
   def index
-
     @tags = Tag.all_with_count :limit=&gt;20
     @latestFeature = PostImage.find(:all, :include =&gt; :post, :limit=&gt;1,:order =&gt; &quot;updated_at DESC&quot;)[0]
     @featured = PostImage.find(:all, :include =&gt; :post, :limit=&gt;50, :order =&gt; &quot;updated_at DESC&quot;)</diff>
      <filename>app/controllers/home_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,6 +11,8 @@ class Group &lt; ActiveRecord::Base
   alias_attribute :category, :group_category
   alias_attribute :images, :post_images
   
+  named_scope :order_by_contributed_at, lambda {  { :order =&gt; &quot;contributed_at DESC&quot; } }
+
   def to_param
     name
   end</diff>
      <filename>app/models/group.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,10 +23,16 @@ class ImportRssItem
                     :remote_url=&gt;@item.link,
                     :group_id=&gt;@group.id
     )
-    if !post.save
-      puts &quot;couldn't save post for group-#{@group.id}, #@group&quot;
-      return
+    if !post.valid?
+      puts &quot;title: #{title}&quot;
+      puts &quot;detail: #{detail}&quot;
+      puts &quot;detail-sanitized: #{HTML::FullSanitizer.new.sanitize(detail)}&quot;
+      puts &quot;remote_url: #{@item.link}&quot;
+      puts &quot;group.id #{@group.id}&quot;
+      puts &quot;couldn't validate post for group-#{@group.id}, #@group&quot;
     end
+    post.save!
+
     guid.save
     self.class.parse_images_from_detail(detail).each do |image|
       if !image.nil?</diff>
      <filename>app/models/import_rss_item.rb</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ class Post &lt; ActiveRecord::Base
   validates_presence_of :title
   validates_presence_of :video, :if =&gt; :specifying_video
   validate :must_have_attachment
-  validates_tiny_mce_presence_of :detail, :unless =&gt; :specifying_video
+  #validates_tiny_mce_presence_of :detail, :unless =&gt; :specifying_video
   
   belongs_to :group
   </diff>
      <filename>app/models/post.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; 20090608173007) do
+ActiveRecord::Schema.define(:version =&gt; 20090609094313) do
 
   create_table &quot;attachments&quot;, :force =&gt; true do |t|
     t.integer  &quot;post_id&quot;
@@ -81,6 +81,7 @@ ActiveRecord::Schema.define(:version =&gt; 20090608173007) do
     t.datetime &quot;created_at&quot;
     t.datetime &quot;updated_at&quot;
     t.integer  &quot;group_category_id&quot;
+    t.datetime &quot;contributed_at&quot;
   end
 
   create_table &quot;imported_guids&quot;, :force =&gt; true do |t|</diff>
      <filename>db/schema.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,7 @@ studio1:
   name: Studio 1
   desc: Studio one is such a cool place
   home_page: MyString
+  contributed_at: &lt;%= 1.day.ago %&gt;
 
 studio3:
   name: Studio Free</diff>
      <filename>test/fixtures/groups.yml</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,29 @@
 require 'test_helper'
 
 class GroupTest &lt; ActiveSupport::TestCase
+  should &quot;should updated_at when new post&quot; do
+    group = Group.find(groups(:studio1).id)
+    assert group.updated_at &lt; (Time.now+ 10)
+    
+    group.posts.new(:title=&gt;'some', :detail=&gt;'some').save!
+    
+    group = Group.find(groups(:studio1).id)
+    assert group.updated_at &gt; (Time.now + 10)
+  end
+  
+  context &quot;Group class&quot; do
+    should &quot;be able to find by contributed_at&quot; do
+      groups = Group.order_by_contributed_at
+      groups = groups.all # make sure we get the array!
+      assert_equal 1, groups.size
+      assert_equal group(:studio1).id,groups[0]
+      
+      Group.find(groups(:studio3).id).posts.new(:title=&gt;'some', :detail=&gt;'some').save!
+          groups = Group.order_by_contributed_at
+      groups = groups.all # make sure we get the array!
+      assert_equal 2, groups.size
+      assert_equal group(:studio3).id,groups[0]
+    end
+  end
+  
 end</diff>
      <filename>test/unit/group_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>abaae65e226bf1bd3283d3960dfe415552046421</id>
    </parent>
  </parents>
  <author>
    <name>Tim Diggins</name>
    <email>tim@red56.co.uk</email>
  </author>
  <url>http://github.com/red56/the-connected-website/commit/3d828c4986afc796b42ff353e3b1292a7d101cd8</url>
  <id>3d828c4986afc796b42ff353e3b1292a7d101cd8</id>
  <committed-date>2009-06-09T03:17:39-07:00</committed-date>
  <authored-date>2009-06-09T03:17:39-07:00</authored-date>
  <message>starting on group orderign tests</message>
  <tree>6362704357ff891150038631e3bbe2361b85a857</tree>
  <committer>
    <name>Tim Diggins</name>
    <email>tim@red56.co.uk</email>
  </committer>
</commit>
