Reputation: 7001
I'm trying to create an HTML file to be uploaded to a different server from a Rails app. I need a solution similar to a mailer in Rails. Does anyone know of a feasible way to achieve this?
Upvotes: 0
Views: 76
Reputation: 38032
If you are trying to send a file between servers, the easiest way is to create an API endpoint on the other server that allows uploading a file and use an API key to secure the connection. You could very easily use an HTTP POST method to perform the transfer (https://rubygems.org/gems/httmultiparty). If you need to generate the file first:
data = render_to_string("post/show")
HTTParty.post('http://other.host/posts', contents: data)
Upvotes: 1