Skip to content

Instantly share code, notes, and snippets.

@luckyruby
Created February 24, 2014 06:12
Show Gist options
  • Select an option

  • Save luckyruby/9182773 to your computer and use it in GitHub Desktop.

Select an option

Save luckyruby/9182773 to your computer and use it in GitHub Desktop.
def upload_locations
if params[:key] == '12345'
@locations = Location.active.order("locations.code")
stream = render_to_string(template: "locations/index", formats: [:xml])
Net::SFTP.start('host', 'user', password: 'pass') do |sftp|
sftp.file.open("locations.xml", "w") do |f|
f.puts stream
end
end
end
render nothing: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment