# RSS help

**URL:** <https://www.ruby-forum.com/t/rss-help/132972>\
**Category:** Rails\
**Created:** [March 26, 2008, 10:33am UTC](https://www.ruby-forum.com/t/rss-help/132972 "2008-03-26T10:33:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![megax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@megax](https://www.ruby-forum.com/u/megax)\
**Post date:** [March 26, 2008, 10:33am UTC](https://www.ruby-forum.com/t/rss-help/132972/1 "2008-03-26T10:33:20Z")

</div>

I have my rss feed working pefectly but I was wondering if I could limit  
it to showing just the 5 most recently updated products.

heres how my rss is coded

xml.instruct!

xml.rss “version” =\> “2.0”, “xmlns:dc” =\> “[http://purl.org/dc/elements/](http://purl.org/dc/elements/)  
1.1/” do  
xml.channel do

xml.title “FlashItem products”  
xml.link url\_for :only\_path =\> false, :controller =\>  
‘products’  
xml.description “Items advertised on the FlashItems website”

```
@products.each do |p|
 xml.item do
  xml.title(p.item_name)
  xml.link(url_for :only_path => false, :controller =>

```

‘products’,:action =\> ‘show’, :id =\> (p.id))  
xml.description(p.description)  
xml.guid(url\_for :only\_path =\> false, :controller =\> ‘products’,  
:action =\> ‘show’, :id =\> (p.id))  
xml.pubDate(p.updated\_at)  
xml.sellername(p.seller\_name)  
xml.selleremail(p.seller\_email)  
end  
end  
end  
end

controller

def rss  
@products = Product.find(:all, :order=\> “item\_name”)  
render :layout =\> false  
end

---

<div class="post-metadata">

**Author:** ![megax](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/94ad74/32.png) [@megax](https://www.ruby-forum.com/u/megax)\
**Post date:** [March 26, 2008, 10:59am UTC](https://www.ruby-forum.com/t/rss-help/132972/2 "2008-03-26T10:59:22Z")

</div>

On 26 Mar 2008, at 09:33, Alan Red wrote:

> I have my rss feed working pefectly but I was wondering if I could  
> limit  
> it to showing just the 5 most recently updated products.
> 
> heres how my rss is coded

Not much to do with your rss, just add a :limit =\> 5 to your  
Product.find and order it by updated\_at.

Fred
