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 8699509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T01:57:57+00:00 2026-06-13T01:57:57+00:00

Im referring to this app link as a tutorial. After looking at it. Im

  • 0

Im referring to this app link as a tutorial. After looking at it. Im curious to understand how the program (client or server)can accesse images. Since the program doesn’t seem to be explicitely saving image urls in the server’s database once they are uploaded to Amazon S3?

After implementing this app, I dont see a column for image_urls or path in the database. But the program magically loads images in the client!!

Something is going on under the hood, what is that something?

Here is the Photo model method:

 Paperclip.interpolates :prefix  do |attachment, style|
   "#{attachment.instance.takenby}/#{Date.today.to_s }/#   
  {attachment.instance.image_file_name}"
 end 

 has_attached_file :image,
                :path => ":prefix/:style/:basename.:extension",
                :styles => { :thumbnail => "57x57", :original => "300x300" },
                :storage => :s3,
                :s3_credentials => S3_CREDENTIALS


  validates :image,:presence => true
  validates :lat, :lng,:presence => true,:numericality => true
  • 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-06-13T01:57:59+00:00Added an answer on June 13, 2026 at 1:57 am

    It’s right there in the options for has_attached_file. You’ve told it how to construct the path for the image (which corresponds to its filename on s3) in the :path argument. So all paperclip needs to know to find the image again is:

    1. The host name for your s3 bucket
    2. The relevant information to re-construct the path – in this case, that looks like :prefix, :basename, :style, and :extension.

    Most of that information is in your database. Presumably :basename comes from the original filename somehow, which ought to be saved in the image_file_name field of the model to which the image is attached. :style depends on which image size you’re looking up at runtime. :extension can be determined from the image_content_type attribute.

    :prefix is a little bit trickier. In fact, I worry that your interpolation rule will break your image lookup, because of the Date.today it uses to construct the prefix. Do you have any images more than one day old? If so, do they still work? I worry that when the image is uploaded, it will have a filename containing that day’s date, and then when you go to find them in the future you’ll reconstruct the url using the new current date, and wind up with a 403 error.

    TL;DR paperclip constructs the image url when it uploads the images to s3, and reconstructs them later from the same parameters.

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

Sidebar

Related Questions

Referring to this question , how can i get the current page size in
I am trying to make practice app where i can scroll images with page
In my iPhone app, I have included two custom fonts and by referring this
Alright, referring to https://github.com/nostra13/Android-Universal-Image-Loader . This app is listing all urls in array.xml .
You can take a look at the app I'm referring to at: http://github.com/585connor/QA So,
i'm referring this address for function olLiTree PHP function that creates a nested ul
referring to this question , I've decided to duplicate the tables every year, creating
Referring to this question: https://stackoverflow.com/questions/2035449/why-is-oop-hard-for-me class Form { protected $inputs = array(); public function
Referring to this web site http://www.cplusplus.com/reference/std/utility/make_pair/ The std::make_pair has this signature (and possible implementation):
Referring to this question, no solution/answer was given for Oracle platform. Selecting Nth Record

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.