我正在疯狂商店工作,让亚马逊s3在主应用上工作得很好。我只是按照阅读我的说明添加了spree-blogging-spree gem,但我现在得到了一个缺失的必需:当我尝试编辑帖子或添加图像时,存储桶选项错误。这仅适用于博客相关的编辑和图像,其他一切仍然正常。
我知道这是指s3,但我不确定它现在出现的原因。是否有我错过的迁移或我需要添加的某种配置文件?
Showing /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/spree-blogging-spree-81da8dd081a5/app/views/spree/admin/blog_entries/_form.html.erb where line #85 raised:
missing required :bucket option
Extracted source (around line #242):
240
241
242
243
244
245
@bucket = @options[:bucket] || s3_credentials[:bucket]
@bucket = @bucket.call(self) if @bucket.respond_to?(:call)
@bucket or raise ArgumentError, "missing required :bucket option"
end
def s3_interface
Trace of template inclusion: /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/spree-blogging-spree-81da8dd081a5/app/views/spree/admin/blog_entries/edit.html.erb
Rails.root: /home/ubuntu/workspace/mumbles_spree
答案 0 :(得分:0)
我想通了我必须将我的s3凭据添加到blog_entry_image.rb:
应用程序/模型/礼包/ blog_entry_image.rb
class Spree::BlogEntryImage < Spree::Image
has_attached_file :attachment,
:styles => {:mini => '48x48#', :normal => '200x200>', :large => '600x600>'},
:default_style => :large,
:url => "/assets/blog_entry_images/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/blog_entry_images/:id/:style/:basename.:extension" ,
storage: :s3,
s3_credentials: {access_key_id: 'xxx',
secret_access_key: 'xxx'},
bucket: 'xxx'
end