Module: PaperclipHeroku::ClassMethods

Included in:
Paperclip::ClassMethods
Defined in:
lib/paperclip_heroku.rb

Instance Method Summary collapse

Instance Method Details

#has_attached_file_with_heroku(name, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/paperclip_heroku.rb', line 13

def has_attached_file_with_heroku(name, options = {})
  if options[:heroku] == true
    # Set per-environment options for Heroku/development
    #
    # :storage is a given. Other options are only set
    # if the user hasn't provided values for them.
     #
    options[:storage]   = environment_storage
    options[:bucket]  ||= ENV['S3_BUCKET']
     options[:s3_host_name]   ||= ENV['S3_HOST_NAME'] || PaperclipHeroku::DEFAULT_S3_HOST_NAME
    options[:s3_credentials] ||= {
       :access_key_id      => ENV['S3_KEY'],
       :secret_access_key  => ENV['S3_SECRET']
    }
  end
  
  has_attached_file_without_heroku(name, options)
end