DB to HTML to FTP?

could someone point me in the right direction with this functionality?

I am looking to create a physical HTML file from a database and then
FTP that file. In rails I can’t seem to get going in the right
direction on either the creation of a HTML file from the DB or the FTP
action once i have it.

Think FTP’ing a file to a website to update a page for CMS purposes.

I am thinking at least the first step isnt far off from what scaffold