I’ve got a controller method that I’d like to cache … the problem is I
only want to cache the XML output of a method. (This is for a number of
reasons, including the fact that the feed of this action gets hit fairly
often, but the html result does no and also contains other,
user-specific info in the layout.)
In other words, I’m wondering how to do the following:
class MyController < ApplicationContorller
caches_action :index, :only_format => :xml
def index
@items = Item.find( :all )
respond_to |format| do
format.html # This should not be action cached
format.xml # This should be action cached
end
end
end
Thanks!