Programmatically ftp from rails app

I would like to create the functionality to ftp a file from my rails
CMS system, does anyone have some insight on FTP functionality/code?

Here we go:

require 'net/ftp'

ftp = Net::FTP.new('example.com')
ftp.login(user = "****", passwd = "****")
ftp.putbinaryfile("/data/images/myimage.jpg", File.basename( "/data/
images/myimage.jpg" ))
ftp.quit()

Also you would obviously want to through a rescue in there for ftp
errors

thank you bud