ruby on rails - upload paperclip attachment to s3 using fog gem for specificaly one model -


i using fog gem upload paperclip attachmets s3. config file. attaches every models attachments s3. trying implement on 1 model... couldnt find documentation of fog paperclip.

config.paperclip_defaults = {           :storage => :fog,           :fog_credentials => {             provider: "aws",             aws_access_key_id: "aws_access_key_id",             aws_secret_access_key: "aws_secret_access_key"           },           :fog_directory => "bucket_name"       } 

the best way define storage facilities each model (i think)

by defining defaults in environment file, you're going define settings models. can use code each model:


#app/models/your_model.rb :styles => { :medium => "x300", :thumb => "x100" },         :default_url => "your_url",         :storage => :s3,         :bucket => '******',         :s3_credentials => s3_credentials  #config/initializers/s3.rb s3_credentials = { :access_key_id => env['s3_key'], :secret_access_key => env['s3_secret']} 

i appreciate not dry, should resolve issue. take code environment files & put models


Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -