Airat Shigapov
Airat Shigapov

Reputation: 585

How and where paperclip via aws-sdk store URLs?

Sorry for maybe dumb question, but I have some misunderstanding about how Paperclip works. If I use it with aws-sdk gem, where image urls are stored?

My model has only fields like image_name, image_size, but not something like image_url. I also tried to list all tables from my db in sql console, but there wasn't any special image-related tables. I know what I can access url by calling my_model.image.url, but I need understanding, where this url is located. Thanks.

Upvotes: 0

Views: 175

Answers (1)

Matt Gibson
Matt Gibson

Reputation: 14949

The urls are auto generated based on the ruleset you have in your paperclip config file. They usually include the name and id of your model unless you have changed the defaults. Set the :default_url option when you call has_attached_file if you want to change it:

:default_url => '/images/:attachment/missing_:style.png',
:path => "avatars/:id/:style/:filename"

More background: rails paperclip default image with S3

Upvotes: 2

Related Questions