Write Static File for View Output?

Is it possible to save a view’s output into a static file rather than
dynamically generate it each request?..

I’ve got a working controller method and view to select my db records
and format them into a custom XML output, but I’d like to save the
view output into “/public/data/{params[:id]}.xml”

On Apr 25, 5:58 pm, Sav [email protected] wrote:

Is it possible to save a view’s output into a static file rather than
dynamically generate it each request?..

I’ve got a working controller method and view to select my db records
and format them into a custom XML output, but I’d like to save the
view output into “/public/data/{params[:id]}.xml”

Sounds to me like you should read up on action controller’s caching
support.

Fred

Just use page caching:

DataController
caches_page :show

def show
# generate the XML
end
end

Now there will be a lot of files like:
/public/data/1.xml
/public/data/2.xml
/public/data/3.xml

Dmitry