简体   繁体   中英

Cant update paperclip attachment with fog gem to s3

I am trying to upload images to s3 but i am facing this error "Missing required arguments: aws_access_key_id, aws_secret_access_key"

class MyModel < ActiveRecord::Base

has_attached_file :attachment,
  :storage => :fog,
  :fog_credentials => {:provider => "AWS",
                       access_key_id: 'key_id',secret_access_key: 'access_key'},
  :fog_directory => 'bucket_name'

end

Use aws_access_key_id and aws_secret_access_key options in fog_credentials instead of access_key_id and secret_access_key .

has_attached_file :attachment,
  :storage => :fog,
  :fog_credentials => {:provider => "AWS",
                       aws_access_key_id: 'key_id',aws_secret_access_key: 'access_key'},
  :fog_directory => 'bucket_name'

Refer to the list of fog_credentials options

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM