public
Description: Paperclip File Management Plugin
Homepage: http://www.thoughtbot.com/projects/paperclip
Clone URL: git://github.com/thoughtbot/paperclip.git
Search Repo:
Updated documentation.
jyurek (author)
Thu May 15 12:09:14 -0700 2008
commit  5fdf96400afaa734735fd095919962c1fcb9bcca
tree    1bcee6fd49a3b72630a65945a5f2a6ce7b1d4d3a
parent  f1bf873f67646aef10c54c8ea0cc95d926beb7f6
...
33
34
35
36
 
 
37
38
39
40
...
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
 
 
 
118
119
120
...
33
34
35
 
36
37
38
39
40
41
...
103
104
105
 
 
 
 
 
 
 
 
 
 
106
107
108
109
110
111
112
113
114
115
0
@@ -33,7 +33,8 @@
0
 require 'paperclip/storage'
0
 require 'paperclip/attachment'
0
 
0
-# The base module that gets included in ActiveRecord::Base.
0
+# The base module that gets included in ActiveRecord::Base. See the
0
+# documentation for Paperclip::ClassMethods for more useful information.
0
 module Paperclip
0
 
0
   VERSION = "2.1.2"
0
0
@@ -102,19 +103,13 @@
0
     # has_attached_file :avatar, :styles => { :normal => "100x100#" },
0
     # :default_style => :normal
0
     # user.avatar.url # => "/avatars/23/normal_me.png"
0
- # * +path+: The location of the repository of attachments on disk. This can be coordinated
0
- # with the value of the +url+ option to allow files to be saved into a place where Apache
0
- # can serve them without hitting your app. Defaults to
0
- # ":rails_root/public/:class/:attachment/:id/:style_:filename".
0
- # By default this places the files in the app's public directory which can be served
0
- # directly. If you are using capistrano for deployment, a good idea would be to
0
- # make a symlink to the capistrano-created system directory from inside your app's
0
- # public directory.
0
- # See Paperclip::Attachment#interpolate for more information on variable interpolaton.
0
- # :path => "/var/app/attachments/:class/:id/:style/:filename"
0
     # * +whiny_thumbnails+: Will raise an error if Paperclip cannot process thumbnails of an
0
     # uploaded image. This will ovrride the global setting for this attachment.
0
     # Defaults to true.
0
+ # * +storage+: Chooses the storage backend where the files will be stored. The current
0
+ # choices are :filesystem and :s3. The default is :filesystem. Make sure you read the
0
+ # documentation for Paperclip::Storage::Filesystem and Paperclip::Storage::S3
0
+ # for backend-specific options.
0
     def has_attached_file name, options = {}
0
       include InstanceMethods
0
 
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
...
42
43
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
46
47
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
0
@@ -1,6 +1,21 @@
0
 module Paperclip
0
   module Storage
0
 
0
+ # The default place to store attachments is in the filesystem. Files on the local
0
+ # filesystem can be very easily served by Apache without requiring a hit to your app.
0
+ # They also can be processed more easily after they've been saved, as they're just
0
+ # normal files. There is one Filesystem-specific option for has_attached_file.
0
+ # * +path+: The location of the repository of attachments on disk. This can (and, in
0
+ # almost all cases, should) be coordinated with the value of the +url+ option to
0
+ # allow files to be saved into a place where Apache can serve them without
0
+ # hitting your app. Defaults to
0
+ # ":rails_root/public/:class/:attachment/:id/:style_:filename".
0
+ # By default this places the files in the app's public directory which can be served
0
+ # directly. If you are using capistrano for deployment, a good idea would be to
0
+ # make a symlink to the capistrano-created system directory from inside your app's
0
+ # public directory.
0
+ # See Paperclip::Attachment#interpolate for more information on variable interpolaton.
0
+ # :path => "/var/app/attachments/:class/:id/:style/:filename"
0
     module Filesystem
0
       def self.extended base
0
       end
0
@@ -42,6 +57,38 @@
0
       end
0
     end
0
 
0
+ # Amazon's S3 file hosting service is a scalable, easy place to store files for
0
+ # distribution. You can find out more about it at http://aws.amazon.com/s3
0
+ # There are a few S3-specific options for has_attached_file:
0
+ # * +s3_credentials+: Takes a path, a File, or a Hash. The path (or File) must point
0
+ # to a YAML file containing the +access_key_id+ and +secret_access_key+ that Amazon
0
+ # gives you. You can 'environment-space' this just like you do to your
0
+ # database.yml file, so different environments can use different accounts:
0
+ # development:
0
+ # access_key_id: 123...
0
+ # secret_access_key: 123...
0
+ # test:
0
+ # access_key_id: abc...
0
+ # secret_access_key: abc...
0
+ # production:
0
+ # access_key_id: 456...
0
+ # secret_access_key: 456...
0
+ # This is not required, however, and the file may simply look like this:
0
+ # access_key_id: 456...
0
+ # secret_access_key: 456...
0
+ # In which case, those access keys will be used in all environments.
0
+ # * +s3_permissions+: This is a String that should be one of the "canned" access
0
+ # policies that S3 provides (more information can be found here:
0
+ # http://docs.amazonwebservices.com/AmazonS3/2006-03-01/RESTAccessPolicy.html#RESTCannedAccessPolicies)
0
+ # The default for Paperclip is "public-read".
0
+ # * +bucket+: This is the name of the S3 bucket that will store your files. Remember
0
+ # that the bucket must be unique across all of Amazon S3. If the bucket does not exist
0
+ # Paperclip will attempt to create it. The bucket name will not be interpolated.
0
+ # * +path+: This is the key under the bucket in which the file will be stored. The
0
+ # URL will be constructed from the bucket and the path. This is what you will want
0
+ # to interpolate. Keys should be unique, like filenames, and despite the fact that
0
+ # S3 (strictly speaking) does not support directories, you can still use a / to
0
+ # separate parts of your file name.
0
     module S3
0
       def self.extended base
0
         require 'right_aws'

Comments

    No one has commented yet.