[英]How and where paperclip via aws-sdk store URLs?
Sorry for maybe dumb question, but I have some misunderstanding about how Paperclip works. 对不起可能是愚蠢的问题,但我对Paperclip的工作方式有一些误解。 If I use it with aws-sdk gem, where image urls are stored?
如果我将它用于aws-sdk gem,那里存储了图片网址?
My model has only fields like image_name
, image_size
, but not something like image_url
. 我的模型只有像
image_name
, image_size
这样的字段,但不像image_url
。 I also tried to list all tables from my db in sql console, but there wasn't any special image-related tables. 我还尝试在sql控制台中列出我的数据库中的所有表,但没有任何特殊的图像相关表。 I know what I can access url by calling
my_model.image.url
, but I need understanding, where this url is located. 我知道我可以通过调用
my_model.image.url
来访问url,但是我需要理解这个url所在的位置。 Thanks. 谢谢。
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.
它们通常包括模型的名称和ID,除非您更改了默认值。 Set the
:default_url
option when you call has_attached_file
if you want to change it: 如果要更改它,请在调用
has_attached_file
时设置:default_url
选项:
:default_url => '/images/:attachment/missing_:style.png',
:path => "avatars/:id/:style/:filename"
More background: rails paperclip default image with S3 更多背景: rails回形针默认图像与S3
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.