I’m currently migrating my project from PHP (codeigniter) to Rails3 and it’s amazing.
But I’m a rails/ruby newbie so I’ve faced a problem which I don’t know how to solve.
I get new stuff on my site (A) from one certain site (B). It works like this:
- On site B on a page I want to submit to my site I click a button.
- Site B makes a POST request to my script on site A with an identifier of that page.
- I take this ID, and make a POST request with CURL back to the site B.
- Site B returns me a JSON feed with links to files.
- Then I use CURL to download the files with that ID.
Sorry if the explanation is a bit cluttered.
For steps 1 and 2 I assume, I have to make a POST route and a method in some controller.
But the rest isn’t that clear to me.
Additionally, in php project I hosted files on the same servers. And now I use heroku, so I need to put those files to S3.
update: On reading the Q again, I see that the remote files must be posted from a remote location into the rails app, not from a user-provided url. Carrierwave can most probably still deal with this, but I have no experience in this particular area.
This is really simple with carrierwave.
Once set up, carrierwave will detect wether something is either a file upload or a path to a remote file and import it.
S3 storage is supported natively, trough fog, wich needs no set-up or configuration other then a few lines in your uploader file in carrierwave itself.