@@ -24,7 +24,15 @@ The complete [RDoc](http://rdoc.info/gems/paperclip) is online.
...
@@ -24,7 +24,15 @@ The complete [RDoc](http://rdoc.info/gems/paperclip) is online.
Requirements
Requirements
------------
------------
ImageMagick must be installed and Paperclip must have access to it. To ensure
### Ruby and Rails
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.)
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.
### Image Processor
[ImageMagick](http://www.imagemagick.org) must be installed and Paperclip must have access to it. To ensure
that it does, on your command line, run `which convert` (one of the ImageMagick
that it does, on your command line, run `which convert` (one of the ImageMagick
utilities). This will give you the path where that utility is installed. For
utilities). This will give you the path where that utility is installed. For
example, it might return `/usr/local/bin/convert`.
example, it might return `/usr/local/bin/convert`.
...
@@ -55,6 +63,10 @@ well with gems.
...
@@ -55,6 +63,10 @@ well with gems.
Include the gem in your Gemfile:
Include the gem in your Gemfile:
gem "paperclip", "~> 3.0"
If you're still using Rails 2.3.x, you should do this instead:
gem "paperclip", "~> 2.7"
gem "paperclip", "~> 2.7"
Or, if you want to get the latest, you can get master from the main paperclip repository:
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,16 +78,6 @@ mentioned in this README, then you probably need to specify the master branch if
use them. This README is probably ahead of the latest released version, if you're reading it
use them. This README is probably ahead of the latest released version, if you're reading it
on GitHub.
on GitHub.
Anyway, if you don't use Bundler (though you probably should, even in Rails 2), with config.gem
# In config/environment.rb
...
Rails::Initializer.run do |config|
...
config.gem "paperclip", :version => "~> 2.7"
...
end
For Non-Rails usage:
For Non-Rails usage:
class ModuleName < ActiveRecord::Base
class ModuleName < ActiveRecord::Base
...
@@ -153,12 +155,33 @@ validation.
...
@@ -153,12 +155,33 @@ validation.
More information about the options to `has_attached_file` is available in the
More information about the options to `has_attached_file` is available in the
documentation of [`Paperclip::ClassMethods`](http://rubydoc.info/gems/paperclip/Paperclip/ClassMethods).
documentation of [`Paperclip::ClassMethods`](http://rubydoc.info/gems/paperclip/Paperclip/ClassMethods).
For validations, attachments can be validated with these Paperclip's validation methods:
For validations, Paperclip introduces several validators to validate your attachment: