# Will\_paginate limit my RSS feeds too.. Any help?

**URL:** <https://www.ruby-forum.com/t/will-paginate-limit-my-rss-feeds-too-any-help/173811>\
**Category:** Rails\
**Created:** [August 15, 2009, 12:09pm UTC](https://www.ruby-forum.com/t/will-paginate-limit-my-rss-feeds-too-any-help/173811 "2009-08-15T12:09:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 15, 2009, 12:09pm UTC](https://www.ruby-forum.com/t/will-paginate-limit-my-rss-feeds-too-any-help/173811/1 "2009-08-15T12:09:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 15, 2009, 12:40pm UTC](https://www.ruby-forum.com/t/will-paginate-limit-my-rss-feeds-too-any-help/173811/2 "2009-08-15T12:40:41Z")

</div>

You’re using the same @posts for your rss feed as for your html. You  
could use a different method for your RSS feed or you can set the  
limit according to the call you’re making.

Why is the @posts = Post.all line there anyway? You could set it to  
@posts\_rss and send that along with your RSS feed.

On 15 aug, 12:09, Philip G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![webstic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/58f4c7/32.png) [@webstic](https://www.ruby-forum.com/u/webstic)\
**Post date:** [August 15, 2009, 1:14pm UTC](https://www.ruby-forum.com/t/will-paginate-limit-my-rss-feeds-too-any-help/173811/3 "2009-08-15T13:14:02Z")

</div>

jhaagmans wrote:

> You’re using the same @posts for your rss feed as for your html. You  
> could use a different method for your RSS feed or you can set the  
> limit according to the call you’re making.
> 
> Why is the @posts = Post.all line there anyway? You could set it to  
> @posts\_rss and send that along with your RSS feed.
> 
> On 15 aug, 12:09, Philip G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

thanks a lot my friend!  
that works for me.
