Skip to content
This repository
Browse code

Update README file mentioning new changes

  • Loading branch information...
commit 8e80310c27e3e98a12aa3905a850b440dc69705f 1 parent ee4107a
Prem Sichanugrist authored March 23, 2012

Showing 1 changed file with 35 additions and 13 deletions. Show diff stats Hide diff stats

  1. 48  README.md
48  README.md
Source Rendered
@@ -24,7 +24,15 @@ The complete [RDoc](http://rdoc.info/gems/paperclip) is online.
24 24
 Requirements
25 25
 ------------
26 26
 
27  
-ImageMagick must be installed and Paperclip must have access to it. To ensure
  27
+### Ruby and Rails
  28
+
  29
+Paperclip now requires Ruby version **>= 1.9.2** and Rails version **>= 3.0** (Only if you're going to use Paperclip with Ruby on Rails.)
  30
+
  31
+If you're still on Ruby 1.8.7 or Ruby on Rails 2.3.x, you can still use Paperclip 2.7.x with your project. Also, everything in this README might not apply to your version of Paperclip, and you should read [the README for version 2.7](http://rubydoc.info/gems/paperclip/2.7.0) instead.
  32
+
  33
+### Image Processor
  34
+
  35
+[ImageMagick](http://www.imagemagick.org) must be installed and Paperclip must have access to it. To ensure
28 36
 that it does, on your command line, run `which convert` (one of the ImageMagick
29 37
 utilities). This will give you the path where that utility is installed. For
30 38
 example, it might return `/usr/local/bin/convert`.
@@ -55,6 +63,10 @@ well with gems.
55 63
 
56 64
 Include the gem in your Gemfile:
57 65
 
  66
+    gem "paperclip", "~> 3.0"
  67
+
  68
+If you're still using Rails 2.3.x, you should do this instead:
  69
+
58 70
     gem "paperclip", "~> 2.7"
59 71
 
60 72
 Or, if you want to get the latest, you can get master from the main paperclip repository:
@@ -66,16 +78,6 @@ mentioned in this README, then you probably need to specify the master branch if
66 78
 use them. This README is probably ahead of the latest released version, if you're reading it
67 79
 on GitHub.
68 80
 
69  
-Anyway, if you don't use Bundler (though you probably should, even in Rails 2), with config.gem
70  
-
71  
-    # In config/environment.rb
72  
-    ...
73  
-    Rails::Initializer.run do |config|
74  
-      ...
75  
-      config.gem "paperclip", :version => "~> 2.7"
76  
-      ...
77  
-    end
78  
-
79 81
 For Non-Rails usage:
80 82
 
81 83
     class ModuleName < ActiveRecord::Base
@@ -153,12 +155,33 @@ validation.
153 155
 More information about the options to `has_attached_file` is available in the
154 156
 documentation of [`Paperclip::ClassMethods`](http://rubydoc.info/gems/paperclip/Paperclip/ClassMethods).
155 157
 
156  
-For validations, attachments can be validated with these Paperclip's validation methods:
  158
+For validations, Paperclip introduces several validators to validate your attachment:
  159
+
  160
+* `AttachmentContentTypeValidator`
  161
+* `AttachmentPresenceValidator`
  162
+* `AttachmentSizeValidator`
  163
+
  164
+Example Usage:
  165
+
  166
+    validates :avatar, :attachment_presence => true
  167
+    validates_with AttachmentPresenceValidator, :attributes => :avatar
  168
+
  169
+Validators can also be defined using the old helper style:
157 170
 
158 171
 * `validates_attachment_presence`
159 172
 * `validates_attachment_content_type`
160 173
 * `validates_attachment_size`
161 174
 
  175
+Example Usage:
  176
+
  177
+    validates_attachment_presence :avatar
  178
+
  179
+Lastly, you can also define multiple validations on a single attachment using `validates_attachment`:
  180
+
  181
+    validates_attachment :avatar, :presence => true,
  182
+      :content_type => { :content_type => "image/jpg" },
  183
+      :size => { :in => 0..10.kilobytes }
  184
+
162 185
 Storage
163 186
 -------
164 187
 
@@ -453,4 +476,3 @@ License
453 476
 -------
454 477
 
455 478
 Paperclip is Copyright © 2008-2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
456  
-

0 notes on commit 8e80310

Please sign in to comment.
Something went wrong with that request. Please try again.