<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>lib/s3_buckets/storage.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -14,6 +14,9 @@ PaperclipExtended is known to work with Paperclip 2.1.2 (current version at the
 * File name normalization
   You can use :normalized_basename string in attachment's :path or :url definition, which is later interpolated. It works just like :basename, but it is normalized by substituting unusual characters with underscores.
 
+* Multiple S3 buckets
+  Enables you to upload attachments to different S3 buckets. Modern web browsers are limited to download 2-4 files from one host at the same time, so placing your files in 4 different buckets (hosts) will let browsers download 8-16 files simultaneously.
+
 ==Usage
 
 ===Custom commands
@@ -49,6 +52,28 @@ In your model:
   
 :normalized_basename works just like :basename, the only difference is that file's basename is normalized by substituting unusual chars with underscores. By &quot;unusual characters&quot; are those that are not matched by /[A-Za-z0-9_-]/ regular expression. For example if &quot;my avatar.jpg&quot; file is uploaded it's normalized basename would be &quot;my_avatar.jpg&quot;. Such normalization may be useful in situations where you normally would url_encode the filename or something like that.
 
+===Multiple S3 buckets
+
+Modern web browsers are limited to download 2-4 files from one host at the same time, so placing your files in 4 different buckets (hosts) will let browsers download 8-16 files simultaneously.
+
+In your model:
+  class User &lt; ActiveRecord::Base
+    has_attached_file :avatar,
+                      :storage =&gt; :s3,
+                      :s3_credentials =&gt; &quot;#{RAILS_ROOT}/config/s3.yml&quot;,
+                      :path =&gt; &quot;avatars/:id/:style_:extension&quot;,
+                      :bucket =&gt; lambda do |attachment|
+                        i = attachment.instance.id % 4
+                        &quot;bucket_#{i}&quot;
+                      end
+  end
+
+This will place each avatar in one of four buckets: bucket_0, bucket_1, bucket_2 or bucket_3. The exact bucket is chosen at runtime and in this case it's based on models id.
+
+Getting attachment's path:
+puts User.find(1).avatar.url(:original)
+# =&gt; http://bucket_1.s3.amazonaws.com/avatars/1/original.jpg
 
+If your attachments are images and you display many of them on the same page, now you should see them loading much faster.
 
 Copyright (c) 2008 Michal Szajbe (http://codetunes.com) and netguru (http://netguru.pl), released under the MIT license</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -1,3 +1,4 @@
 require 'commands/attachment'
 require 'commands/thumbnail'
-require 'interpolations/attachment'
\ No newline at end of file
+require 'interpolations/attachment'
+require 's3_buckets/storage'
\ No newline at end of file</diff>
      <filename>lib/paperclip_extended.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>README</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>133352aa0bb979b67cfd46a414fdae1956fa73d6</id>
    </parent>
  </parents>
  <author>
    <name>Micha&#322; Szajbe</name>
    <email>netguru@netguru.pl</email>
  </author>
  <url>http://github.com/netguru/paperclip-extended/commit/919ae567f046dbbda623293efa86f6e8716b7b97</url>
  <id>919ae567f046dbbda623293efa86f6e8716b7b97</id>
  <committed-date>2008-10-24T17:15:08-07:00</committed-date>
  <authored-date>2008-10-24T17:15:08-07:00</authored-date>
  <message>Now can upload to different s3 buckets to improve download speed by web browsers</message>
  <tree>65647a99431e763a5750ae99a6b3a60087a90ca9</tree>
  <committer>
    <name>Micha&#322; Szajbe</name>
    <email>netguru@netguru.pl</email>
  </committer>
</commit>
