REST + Pagination + Caching

Hi all,

I want to have a RESTful resource (because I need to use atom_feed_builder).

For the sake of the exemple, let say I need : map.resources :news

I want to be able to list all the news in index action, paginate it
(using will_paginate for example) and add cache to it each paginated

To add cache I need to have url like news/page/2, urls like
news/?page=2 can't be cached page by rails.

So any idea to solve this problem ?


The answer was "use fragment caching"

# Controller
def index
    unless read_fragment({:page => params[:page] || 1}) # Add the
page param to the cache naming
      @news = News.paginate :all, :page => params[:page]

# View
<% cache ({:page => params[:page] || 1}) do %>
     ... All of the html to display the posts ...
<% end %>