From 9290b0e4b3f51e31fe3296f7896cd4c4598065c9 Mon Sep 17 00:00:00 2001 From: jyurek Date: Tue, 25 Sep 2007 14:55:34 +0000 Subject: [PATCH] Docced it up for S3 git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@223 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa --- lib/paperclip/paperclip.rb | 15 +++++++++++++++ lib/paperclip/storage/filesystem.rb | 6 +++--- lib/paperclip/storage/s3.rb | 6 +++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/paperclip/paperclip.rb b/lib/paperclip/paperclip.rb index d64ad1678..bcd6858be 100644 --- a/lib/paperclip/paperclip.rb +++ b/lib/paperclip/paperclip.rb @@ -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 diff --git a/lib/paperclip/storage/filesystem.rb b/lib/paperclip/storage/filesystem.rb index 591bd6cf5..fc76400e5 100644 --- a/lib/paperclip/storage/filesystem.rb +++ b/lib/paperclip/storage/filesystem.rb @@ -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"] diff --git a/lib/paperclip/storage/s3.rb b/lib/paperclip/storage/s3.rb index 61785fb13..3901e8a4d 100644 --- a/lib/paperclip/storage/s3.rb +++ b/lib/paperclip/storage/s3.rb @@ -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"]