我正在使用Rails和Heroku以及AWS S3来部署通过教程创建的pinterest网站。用户可以成功地将图像上传到我的s3存储桶。问题是,上传的图像应该显示在索引(和显示)中,但不要。图片已成功上传到aws s3存储桶但未在我的网站上显示
我创建了一个存储桶策略,以便启用'getobject'方法。
{
"Id": "Policy1445210052484",
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1445209989872",
"Action": [
"s3:GetObject"
],
"Effect": "Allow",
"Resource": "arn:aws:s3:::wyattsbucket/*",
"Principal": "*"
}
]
}
这里是我的网站上张贴的截图:
的Heroku没有收到任何错误,所以我认为这个问题是无论是在S3桶或在我的Rails环境。这是我的第一篇文章,请原谅业余的格式,如果您有任何想法,请让我知道!
在此先感谢。
=的form_tag pins_path
的意见/销/ index.html.haml
#pins.transitions-enabled
- @pins.each do |pin|
.box.panel.panel-default
= link_to (image_tag pin.image.url), pin
.panel-body
%h2= link_to pin.title, pin
%p.user
Submitted by
= pin.user.email
型号/ pin.rb
class Pin < ActiveRecord::Base
acts_as_votable
belongs_to :user
has_attached_file :image, styles: { medium: "500x500>" }
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
end
请为HTML打开一个新问题! – user2954587