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
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---