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 5/30/06, Paul <ptsung@gmail.com> wrote:> 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.
>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>