I found the answer here How to use YML values ββin config / initalizer
First I load into yaml and paste it into a constant.
#config/initializers/constants.rb S3_CONFIG = YAML.load_file("#{::Rails.root}/config/amazon_s3.yml")
Then, when I create a paperclip for the model, pull these values, making sure that I refer to the current environment:
class Entry < ActiveRecord::Base has_attached_file :media, :styles => { :medium => "300x300>", :thumb => "110x110>" }, :storage => :s3, :bucket =>S3_CONFIG[::Rails.env]["bucket"], :s3_credentials => { :access_key_id => S3_CONFIG[::Rails.env]["access_key_id"], :secret_access_key => S3_CONFIG[::Rails.env]["secret_access_key"] } end
Max williams
source share