[typo] Fixing category & tag feeds

Aitor Garcia Rey aitor.garcia at gmail.com
Mon Sep 5 09:04:05 EDT 2005

Browsing the app/controllers/xml_controller.rb for integrate my blog on a 
planet-like site (
http://weblogs.javahispano.org/planet.do?rmik=tabbedmenu.planet) , I've 
found the by category & by tag feeds are working on ascendant order, while - 
as the by article/tracback/comments feeds- the logic order is DESC.

I'm real nuby XD and since I can't figure out the existence of a 
".sort_by_desc" method I've simply patched the source as :

-- --- app/controllers/xml_controller.rb (revision 629)
+++ app/controllers/xml_controller.rb (working copy)
@@ -40,6 +40,7 @@
category = Category.find_by_permalink(params[:id])
@items = category.articles.sort_by {|a| a.created_at}.
reject {|a| a.published != 1 }.
+ reverse!.
@feed_title = "#{config[:blog_name]}: Category
@link = url_for({:controller => "articles", :action => "category", :id => 

...and the same stuff for by tag feed.

If someone could confirm that this is the best way to do it -surely not :-D 
-, I would submit the [PATCH] ticket with the test etc. Anyways it would be 
great to listen to others more experienced ruby hackers a better way to 
patch this.

Un saludo,
Aitor Garcia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20050905/e10c693b/attachment-0001.htm

More information about the Typo-list mailing list