hi i use will_paginate for pagination in my blog. i set itto limit 3
posts per page but also limit my RSS feeds any suggestion ?
this is my code:
controllers/posts.controller.rb
def index
@posts = Post.all
@posts = Post.paginate :page => params[:page], :order => âcreated_at
DESCâ, :per_page=>3
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
format.json { render :json => @posts }
format.rss { render }
end
end
index.rss.builder
xml.instruct! :xml, :version => â1.0â
xml.rss :version => â2.0â do
xml.channel do
xml.title âwebstic blogâ
xml.description ââ
xml.author âphilipâ
xml.link posts_url(:rss)
for post in @posts
xml.item do
xml.title post.title
xml.description post.body
xml.author post.author
xml.pubDate post.created_at.to_s(:rfc822)
end
end
end
end