0

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?

1 Answer 1

1

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)
Sign up to request clarification or add additional context in comments.

1 Comment

That's kinda useful, cheers, but I need to create the file before I can upload/transfer it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.