README.md in paperclip-aws-1.4.0 vs README.md in paperclip-aws-1.4.1

- old
+ new

@@ -1,10 +1,10 @@ [![Build Status](https://secure.travis-ci.org/igor-alexandrov/paperclip-aws.png)](http://travis-ci.org/igor-alexandrov/paperclip-aws) # Paperclip storage module to use Amazon S3 with official 'aws-sdk' gem # -'paperclip-aws' is a full featured storage module that supports all S3 locations (American, European and Japanese) without any additional hacking. +**paperclip-aws** is a full featured storage module that supports all S3 locations (American, European and Japanese) without any additional hacking. ## Features ## * supports US, European and Japanese S3 instances; * supports both `http` and `https` urls; @@ -26,11 +26,11 @@ gem install paperclip-aws After this add 'paperclip-aws' to your `Gemfile` or `environment.rb` -## Using Storage ## +## Common Usage ## class SomeS3Attachment < ActiveRecord::Base def self.s3_config @@s3_config ||= YAML.load(ERB.new(File.read("#{Rails.root}/config/s3.yml")).result)[Rails.env] end @@ -50,11 +50,11 @@ :s3_host_alias => self.s3_config['s3_host_alias'], :s3_permissions => :public_read, :s3_protocol => 'http', :s3_options => { :sse => 'AES256', - :storage_class => :reduced_redundancy + :storage_class => :reduced_redundancy, :content_disposition => 'attachment' }, :path => "company_documents/:id/:style/:data_file_name" @@ -63,12 +63,17 @@ self.data.s3_options[:content_disposition] = "attachment; filename=#{self.data_file_name}" self.data.s3_options[:sse] = true if self.confidential_information? self.data.s3_options[:storage_class] = true if self.unimportant_information? end end + +Create link for file that will expire in 10 seconds after it was created. Useful when redirecting user to file. + + file.data.url(:original, { :expires => Time.now + 10.seconds, :protocol => 'https' }) + -## Possible options ## +## Configuration ## ### :endpoint ### Endpoint where your bucket is located. Default is `'s3.amazonaws.com'` which is for 'US Standard' region. You can find full list of endpoints and regions [here](http://aws.amazon.com/articles/3912#s3) @@ -100,13 +105,14 @@ ### :s3_options ### Hash of additional options. Available options are: * `:sse` – `'AES256'` (the only available encryption now) * `:storage_class` – `:standard` (default) or `:reduced_redundancy` +* `:content_disposition` -## Get your data +## How `paperclip-aws` creates urls? 'paperclip-aws' redefines Paperclip `url` method to get object URL. def url(style=default_style, options={}) end @@ -131,14 +137,17 @@ * `:put` or `:write` * `:delete` Default is set to `:read`, which is the most common used. -## Examples - -Create link for file that will expire in 10 seconds after it was created. Useful when redirecting user to file. - - file.data.url(:original, { :expires => Time.now + 10.seconds, :protocol => 'https' }) - +## Can I use it in production? + +Yes, usage of **paperclip-aws** is confirmed by several rather big projects: + +* [www.sdelki.ru](http://www.sdelki.ru) +* [www.lienlog.com](http://www.lienlog.com) (opens for public in December 2011) +* [www.sharypic.com](http://www.sharypic.com) (soon) + +I hope that it is used in a lot of other projects, if you know them – let me know. [0]: https://github.com/thoughtbot/paperclip [1]: https://github.com/amazonwebservices/aws-sdk-for-ruby \ No newline at end of file