Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5956635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:17:08+00:00 2026-05-22T18:17:08+00:00

I have a ruby on rails project I have some few thousand files associated

  • 0

I have a ruby on rails project
I have some few thousand files associated with the site.
Is there a simple way to move all the files from virtual host to cloud (amazon).

Basically I have a lot of images and I am using paperclip gem to store the images.There are already a few users and have thousands of images . Now I have planned to migrate to cloud(amazon). I have used aws-s3 gem for this purpose and it works fine for new images.

But How do I put the old images which were already uploaded ?

Do I have to manually zip and reupload ? or is there a better way ?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T18:17:08+00:00Added an answer on May 22, 2026 at 6:17 pm

    Hi I would right a simple rake task to accomplish this. It would look like something like this (not tested):

    desc "port files to s3"
    task :port => :environment do
        AWS::S3::Base.establish_connection!(
            :access_key_id => S3_CONFIG['access_key_id'],
            :secret_access_key => S3_CONFIG['secret_access_key']
        )
        Images.all.each do |image|
          new_image_path = "/images/#{image.id}/#{image.file_name_with_extension}"
          AWS::S3::Object.store(new_image_path,open(image.current_path_to_image),S3_CONFIG['bucket_name'],:access => :public_read)  
        end
    end
    

    A few notes:
    if you are using paperclip to manage and access the files you will want to store them in s3 so paperclip can access them. To do that use Paperclip::Interpolations.interpolate method. like:

    new_image_path = Paperclip::Interpolations.interpolate("/accounts/:account_id/images/:id/:style/:basename.:extension",image,:small)
    

    And this goes without saying — make sure you test this in a staging environment!

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails 3 project that uses some java jar files. I'm putting
What is best way to refactor in Ruby on Rails. I have a project
I'm working on a ruby on rails project that requires recording some simple user
This is not a ruby/rails project deploy. I have the following situation and I
I am building a ruby on rails project. it is a portal. I have
Hello Ruby/Rails/Merb developers! Im currently working on a web project that will have a
I do have experience with Ruby on Rails, and am programming a project in
I have an existing project written in Ruby on Rails. It is sort of
I have recently started a project in Ruby on Rails. I used to do
I have a ruby on rails project with scaffolding , views, layouts, models and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.