Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon s3 S3照片身份证问题_Amazon S3 - Fatal编程技术网

Amazon s3 S3照片身份证问题

Amazon s3 S3照片身份证问题,amazon-s3,Amazon S3,型号:1 class PromotionPhoto < ActiveRecord::Base has_attached_file :photo, :styles => { :large => "524x257!", :xmedium => "435x330!", :medium => "329x152!", :thumb => "100x100!"

型号:1

class PromotionPhoto < ActiveRecord::Base
     has_attached_file :photo,
       :styles => {
           :large => "524x257!",
           :xmedium => "435x330!",
           :medium => "329x152!",
           :thumb => "100x100!"
       },
       :storage => :s3,
        :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
        :path => ":attachment/:id/:style.:extension" 
 end
促销\菜单\照片
问题:如果我上传的促销照片显示正确。但同样的照片显示促销菜单也一样。怎么了?您能帮助我吗?

两种型号的附件路径相同:

:path=>:attachment/:id/:style.:extension

在两种型号中,附件名称均为photo

更改其中一个模型中的附件名称或路径


以下是回形针附带的文档文件:

两种型号的附件路径相同:

:path=>:attachment/:id/:style.:extension

在两种型号中,附件名称均为photo

更改其中一个模型中的附件名称或路径


这是回形针的文档,随附文件:

谢谢。如何改变路径?例如:path=>:model_name/:attachment/:id/:style.:extension在路径模板中,您可以使用model提供的任何方法。先说一句:谢谢。如何改变路径?例如:path=>:model_name/:attachment/:id/:style.:extension在路径模板中,您可以使用model提供的任何方法。在此之前,请先:
class PromotionMenuPhoto < ActiveRecord::Base

        has_attached_file :photo,
       :styles => {
           :thumb => "50x50!"
       },
       :storage => :s3,
        :s3_credentials => "#{RAILS_ROOT}/config/s3.yml",
        :path => ":attachment/:id/:style.:extension"
end
id | photo_file_name | photo_content_type |  photo_file_size 
id | photo_file_name | photo_content_type |  photo_file_size