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

  • Home
  • SEARCH
  • 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 6127689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:32:25+00:00 2026-05-23T16:32:25+00:00

My Ruby on Rails application uses S3 and Paperclip. I have users upload a

  • 0

My Ruby on Rails application uses S3 and Paperclip. I have users upload a text file, which works fine. I also want to allow them to edit the text file and resave it… this is where I’m confused. Since they’re not re-uploading any file, but rather EDITING the contents of the saved text file. How can I do this?

Equivalently, how do you create / save a model with Paperclip, without uploading an actual file?

Here’s something I tried…

Source.new(:user_id => 4,
           :name => "untitled.txt",
           :attachment_file_name => "untitled.txt",
           :attachment_content_type => "application/octet-stream",
           :attachment_contents => "This is a sample text file. Edit and resave to change this.")
      .save

PS – I’m saving the files on S3 instead of a database blog because they could potentially be large, and that seems unsuited for a database.

EDIT: I’m adding a bounty that I’ll award to anyone who can show me how to do this without requiring the user to save a text file and reupload it. I have a HTML textarea and want to offer an AJAXed “Save” button to resave a text file on S3.

  • 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-23T16:32:26+00:00Added an answer on May 23, 2026 at 4:32 pm

    Sounds like you are mixing two conceptually different approaches: DB store and file store. So from my point of view, you should go for either one of the 2 options:

    Option 1: Use a file storage (like Amazon S3)

    This seems to be answered thoroughly by Ben Simpson. If you want to allow the user to edit a file-backed resource, then you have to make sure to “manipulate the contents of the file on S3 outside of Paperclip.”

    Option 2: Use db-storage

    It sounds to me like this is what you ultimately want to achieve. The file upload serves as the entry point for user-created content into your application. Since you are dealing with simple text files, I suggest saving the uploaded file’s contents into your model, which you can then update just like any other model (including your ajax save).

    For the initial values, i.e. “This is a sample text file. Edit and resave to change this.”, you can either use the :default option in the migration file, or if you insist on a physical file to be present, use paperclip :default_url on the has_attached_file method along with a file that includes the template content.

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

Sidebar

Related Questions

At the moment I have a Ruby on Rails application which maintains my Users,
I have a ruby-on-rails application and I'm now wondering why RoR uses Restful Requests:
I am developing Ruby on Rails application which uses Thinking Sphinx. Unfortunately, from time
I have a ruby on rails application with an input text field that has
I want to log user's actions in my Ruby on Rails application. So far,
Within Ruby on Rails applications database.yml is a plain text file that stores database
My Ruby on Rails application uses the following controller code to generate a sitemap.xml
I have developed a Ruby on Rails application and successfully deployed on Weblogic using
I am building an application in Cocoa that uses a local Ruby on Rails
We are planning to deploy a Rails 2.3.8 application which uses MongoDB, on our

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.