RSS help

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/
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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs