Module: Paperclip::S3::ClassMethods
- Defined in:
- lib/paperclip-s3.rb
Instance Method Summary collapse
-
#has_attached_file(name, options = {}) ⇒ Object
Extends the paperclips has_attached_file method It will use S3 Storage.
Instance Method Details
#has_attached_file(name, options = {}) ⇒ Object
Extends the paperclips has_attached_file method It will use S3 Storage. The credentials will be read from the environment
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/paperclip-s3.rb', line 19 def has_attached_file(name, = {}) s3_protocol = !!ENV["S3_PROTOCOL"] ? ENV["S3_PROTOCOL"] : "http" [:storage] = :s3 [:path] ||= "/:class-:attachment/:id/:style-:basename.:extension" [:bucket] ||= ENV["S3_BUCKET"] [:s3_protocol] ||= s3_protocol [:s3_credentials] ||= { :access_key_id => ENV['S3_KEY'], :secret_access_key => ENV['S3_SECRET'] } super(name, ) end |