Commit 9290b0e4 by jyurek

Docced it up for S3

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@223 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent 66b47339
......@@ -103,6 +103,21 @@ module Thoughtbot #:nodoc:
# 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
......
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 @@ module Thoughtbot
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"]
......
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 @@ module Thoughtbot
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"]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment