Permalink
Browse files

Docced it up for S3

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@223 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
1 parent 66b4733 commit 9290b0e4b3f51e31fe3296f7896cd4c4598065c9 jyurek committed Sep 25, 2007
Showing with 21 additions and 6 deletions.
  1. +15 −0 lib/paperclip/paperclip.rb
  2. +3 −3 lib/paperclip/storage/filesystem.rb
  3. +3 −3 lib/paperclip/storage/s3.rb
View
@@ -103,6 +103,21 @@ module ClassMethods
# URL, not relative to the +url_prefix+. This field is interpolated.
# has_attached_file :avatar, :missing_url => "/images/default_:style_avatar.png"
# User.new.avatar_url(:small) # => "/images/default_small_avatar.png"
+ # * +storage+: Paperclip has two ways of storing your files. The first is on the filesystem, as specified by
+ # the +path_prefix+ and +path+ parameters. The second is using Amazon's S3 service, via the AWS::S3 gem.
+ # When +storage+ is set to :s3, Paperclip will at :s3_credentials_file in its options for a path to a YAML
+ # file that will specify the access_key_id and secret_access_key for S3. If none is specified, it will look
+ # for a the same file at the default location of +RAILS_ROOT/config/s3.yml+. When using S3, the +url_prefix+
+ # is the name of the bucket in which the files will be stored. Note that while the +url_prefix+ is still
+ # interpolated, S3 does not allow anything but alphanumerics and underscores, so it's a good practice to keep
+ # your interpolations to the +path+ parameter. Files are stored with default permissions of :public_read. You
+ # can read more about AWS::S3 here[http://amazon.rubyforge.org/].
+ # Please note that S3 support is still experimental in Paperclip and does not have full test coverage. Use
+ # at your own risk.
+ # has_attached_file :avatar, :storage => :s3
+ # :url_prefix => "bucket",
+ # :path => ":attachment/:style/:id/:name"
+ # user.avatar_url # => "http://s3.amazonaws.com/bucket/avatars/original/13/me.png"
#
# == Interpolation
# The +path_prefix+, +url_prefix+, and +path+ options can have dynamic interpolation done so that the
@@ -1,6 +1,6 @@
module Thoughtbot
module Paperclip
- module ClassMethods
+ module ClassMethods #:nodoc:
def has_attached_file_with_fs *attachment_names
has_attached_file_without_fs *attachment_names
@@ -9,8 +9,8 @@ def has_attached_file_with_fs *attachment_names
end
- class Storage
- class Filesystem < Storage
+ class Storage #:nodoc:
+ class Filesystem < Storage #:nodoc:
def path_for attachment, style = nil
style ||= attachment[:default_style]
file = attachment[:instance]["#{attachment[:name]}_file_name"]
@@ -1,6 +1,6 @@
module Thoughtbot
module Paperclip
- module ClassMethods
+ module ClassMethods #:nodoc:
def has_attached_file_with_s3 *attachment_names
attachments, options = has_attached_file_without_s3 *attachment_names
@@ -35,8 +35,8 @@ def s3_credentials_file
end
end
- class Storage
- class S3 < Storage
+ class Storage #:nodoc:
+ class S3 < Storage #:nodoc:
def path_for attachment, style = nil
style ||= attachment[:default_style]
file = attachment[:instance]["#{attachment[:name]}_file_name"]

0 comments on commit 9290b0e

Please sign in to comment.