Hi, I am trying to figure out a way to save the view of an action to a file. I have an action call makehtml. It gets data from a database and create a view that display the result in a browser. I would like to save that result view page to a file in public/htmls for example. Does anyone know how I can do this? Thanks for all your help in advance.
on 2006-05-30 00:24
on 2006-05-30 07:37
You can probably use an after_filter: class MyController < ApplicationController after_filter :save_html, :only => :makehtml def makehtml # Do normal stuff end def save_html File.open('/tmp/makehtml.html', 'w') do |f| f.write response.body end end end That should do it (untested). -Jonathan.
on 2006-05-31 06:33
Jonathan, Thank you very much! That worked very well. Paul