Take the 2-minute tour ×

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:

  1. On site B on a page I want to submit to my site I click a button.
  2. Site B makes a POST request to my script on site A with an identifier of that page.
  3. I take this ID, and make a POST request with CURL back to the site B.
  4. Site B returns me a JSON feed with links to files.
  5. 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.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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.

    <label>My Avatar URL:</label>
    <%= image_tag(@user.avatar_url) if @user.avatar? %>
    <%= f.text_field :remote_avatar_url %>
<% end %>

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.

share|improve this answer
I haven't tried it yet, but I believe it'll do. Thanks, berkes –  bassneck Apr 26 '11 at 20:47
add comment

Your Answer


