<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>app/views/ads/category_feed.rss.builder</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -7,6 +7,8 @@ class AdsController &lt; ApplicationController
       flash[:warning] = 'Error - That Ad Does Not Exist'
       redirect_to root_path
     end
+    
+    @category = @ad.category
   end
   
   # destroy ad with that particular hash
@@ -31,19 +33,11 @@ class AdsController &lt; ApplicationController
   # have a page slug how to identify one vs. the other?  might be easier to 
   # inherit then do this code checking tfor a blank array..
   def list
-    @category = Category.find_by_slug(params[:slug])
-    if @category
-      @ads = @category.ads.all_active
-      @requested_category = @category.parent_category.name + ' &gt;&gt; ' + @category.name
-    else
-      @category = ParentCategory.find_by_slug(params[:slug])
-      if @category
-        @ads = @category.all_ads
-        @requested_category = @category.name
-      else
-        flash[:warning] = 'Invalid Request'
-        redirect_to root_path
-      end
+    @slug = params[:slug]
+    @ads = Ad.all_active_by_slug(params[:slug])
+    if !@ads
+      flash[:warning] = 'Invalid Request'
+      redirect_to root_path
     end
   end
   
@@ -191,7 +185,7 @@ class AdsController &lt; ApplicationController
   end
   
   
-  # rss feed 
+  # rss feed for the whole site
   def feed
     @ads = Ad.all_active
     
@@ -201,5 +195,15 @@ class AdsController &lt; ApplicationController
     end
   end
   
+  # rss feed for just one category
+  def category_feed
+    @ads = Ad.all_active_by_slug(params[:slug])
+    
+    respond_to do |format|
+      format.rss { render :layout =&gt; false }
+      format.atom # index.atom.builder
+    end
+  end
+  
   
 end</diff>
      <filename>app/controllers/ads_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -23,5 +23,13 @@ module ApplicationHelper
     return false
   end
  end
+ 
+ def rss_url(slug)
+ 	if slug
+	  return '/' + slug + '/feed' 
+	else       
+	  return '/feed' 
+  end
+ end
 
 end</diff>
      <filename>app/helpers/application_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -66,6 +66,24 @@ class Ad &lt; ActiveRecord::Base
     find(:all, :conditions =&gt; ['expiration &gt; ? and active = ?', Time.now, true], :order =&gt; 'created_at ASC')
   end
   
+  def self.all_active_by_slug(slug)
+    category = Category.find_by_slug(slug)
+    if category
+      return category.ads.all_active
+    else
+      category = ParentCategory.find_by_slug(slug)
+      if category
+        return category.all_ads
+      else
+        return false
+      end
+    return false
+  end
+    
+    
+    find(:all, :conditions =&gt; ['expiration &gt; ? and active = ?', Time.now, true], :order =&gt; 'created_at ASC')
+  end
+  
   def self.display_paged_data(page)
     paginate(:page =&gt; page, :per_page =&gt; 10,:order =&gt; &quot;id&quot;)
   end</diff>
      <filename>app/models/ad.rb</filename>
    </modified>
    <modified>
      <diff>@@ -4,7 +4,7 @@
 	&lt;title&gt;Chuckslist&lt;/title&gt;
 	&lt;%= stylesheet_link_tag &quot;style&quot;, :cache =&gt; true %&gt;
     &lt;%= stylesheet_link_tag 'chuckslist', :cache =&gt; true  %&gt;
-	&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;RSS Feed&quot; href=&quot;/feed&quot; /&gt;        
+	&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;RSS Feed&quot; href=&quot;&lt;%= rss_url(@slug) %&gt;&quot;/&gt;
 	&lt;%= javascript_include_tag :defaults, :cache =&gt; true %&gt;
 	&lt;%= javascript_include_tag &quot;lowpro&quot; %&gt;
 &lt;/head&gt;
@@ -16,7 +16,7 @@
 	&lt;div id=&quot;hd&quot;&gt;
            &lt;p&gt;&lt;img src =&quot;/images/chuckslistlogo.png&quot;&gt;&lt;/p&gt;
 	   &lt;p&gt;
-             &lt;%= link_to 'ChucksList', root_path %&gt; | &lt;%= link_to 'Post a New Ad', :controller =&gt; 'ads', :action =&gt; 'post' %&gt; | &lt;%= link_to 'RSS', :controller =&gt; 'ads', :action =&gt; 'feed' %&gt;&lt;% if is_admin %&gt; | &lt;a href=&quot;/admin&quot;&gt;Admin&lt;/a&gt;&lt;% end %&gt;
+             &lt;%= link_to 'ChucksList', root_path %&gt; | &lt;%= link_to 'Post a New Ad', :controller =&gt; 'ads', :action =&gt; 'post' %&gt; | &lt;%= link_to 'RSS', rss_url(@slug) %&gt;&lt;% if is_admin %&gt; | &lt;a href=&quot;/admin&quot;&gt;Admin&lt;/a&gt;&lt;% end %&gt;
              &lt;% if logged_in? %&gt; | &lt;a href=&quot;/logout&quot;&gt;&lt;%= current_user.email %&gt;[Logout]&lt;/a&gt;&lt;% end %&gt;
            &lt;/p&gt;
 	&lt;/div&gt;</diff>
      <filename>app/views/layouts/application.html.erb</filename>
    </modified>
    <modified>
      <diff>@@ -41,6 +41,8 @@ ActionController::Routing::Routes.draw do |map|
   # maps a route of http://chuckslist.org/forsale/ to list all ads with the category slug 'forsale'
   map.connect ':slug', :controller =&gt; 'ads', :action =&gt; 'list'
   
+  map.connect ':slug/feed', :controller =&gt; 'ads', :action =&gt; 'category_feed'
+  
   # maps a route of /destroy/hash/ to ads controller, action destroy
   map.connect 'ads/destroy/:activation_hash', :controller =&gt; 'ads', :action =&gt; 'destroy', :method =&gt; :post
   </diff>
      <filename>config/routes.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>48688466d457d211963a7673693f1a8f63fa40cb</id>
    </parent>
  </parents>
  <author>
    <name>Alexander</name>
    <email>aybarbara@gmail.com</email>
  </author>
  <url>http://github.com/goodkarma/chuckslist/commit/7fa275eb1bd10671c27b511ba7bebdf22a591682</url>
  <id>7fa275eb1bd10671c27b511ba7bebdf22a591682</id>
  <committed-date>2008-05-19T07:42:52-07:00</committed-date>
  <authored-date>2008-05-19T07:42:52-07:00</authored-date>
  <message>added dynamic rss feeds based on category, now just go to /category_slug/feed/</message>
  <tree>e79918eea03f7d1d026eb20fc817829f4190a393</tree>
  <committer>
    <name>Alexander</name>
    <email>aybarbara@gmail.com</email>
  </committer>
</commit>
