简体   繁体   English

通过aws-sdk存储URL的回形针的方式和位置?

[英]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_nameimage_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.

相关问题 Paperclip aws-sdk错误:未初始化的常量 - Paperclip aws-sdk error: uninitialized constant 如何在显示视图中访问Rails / Paperclip S3资产,aws-sdk 2 - How to access Rails / Paperclip S3 assets in show view, aws-sdk 2 使用paperclip和aws-sdk gem不会上传头像 - Avatar is not getting uploaded using paperclip and aws-sdk gem 使用aws-sdk将存储桶中的文件复制到回形针附件 - Copy file in a bucket to a paperclip attachment with aws-sdk 在AWS-SDK中保存时回形针图像不可见 - Paperclip image does not visible when save in aws-sdk 如何配置AWS-SDK在本地运行 - How to configure AWS-SDK to run locally 使用Paperclip和aws-sdk根据现有样式生成新样式的缩略图 - Generate new style thumbnail based on existing style using Paperclip and aws-sdk Rails 3.2.5中的Paperclip / S3问题“无法加载此类文件-aws-sdk” - Issue with Paperclip/S3 in Rails 3.2.5 “cannot load such file — aws-sdk” NoMethodError-Ruby中AWS-SDK中User:Class的未定义方法'where' - NoMethodError - undefined method 'where' for User:Class in aws-sdk for ruby 尝试使用回形针和aws-sdk gem发布图像时,出现NoMethodError(nil:NilClass的未定义方法“ first”) - NoMethodError (undefined method `first' for nil:NilClass) when trying to post an image with paperclip and aws-sdk gems
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM