Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
Fixes #723
  • Loading branch information
sikachu committed Mar 2, 2012
1 parent 0efa384 commit 5dba614
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions README.md
Expand Up @@ -55,7 +55,7 @@ well with gems.

Include the gem in your Gemfile:

gem "paperclip", "~> 2.0"
gem "paperclip", "~> 2.7"

Or, if you want to get the latest, you can get master from the main paperclip repository:

Expand All @@ -72,7 +72,7 @@ Anyway, if you don't use Bundler (though you probably should, even in Rails 2),
...
Rails::Initializer.run do |config|
...
config.gem "paperclip", :version => "~> 2.4"
config.gem "paperclip", :version => "~> 2.7"
...
end

Expand Down Expand Up @@ -106,6 +106,8 @@ In your migrations:
end
end

(Or you can use migration generator: `rails generate paperclip user avatar`)

In your edit and new views:

<%= form_for :user, @user, :url => user_path, :html => { :multipart => true } do |form| %>
Expand Down Expand Up @@ -199,9 +201,9 @@ thumbnail images. By defining a subclass of Paperclip::Processor, you can
perform any processing you want on the files that are attached. Any file in
your Rails app's lib/paperclip\_processors directory is automatically loaded by
paperclip, allowing you to easily define custom processors. You can specify a
processor with the :processors option to has\_attached\_file:
processor with the :processors option to `has_attached_file`:

has_attached\_file :scan, :styles => { :text => { :quality => :better } },
has_attached_file :scan, :styles => { :text => { :quality => :better } },
:processors => [:ocr]

This would load the hypothetical class Paperclip::Ocr, which would have the
Expand Down Expand Up @@ -251,8 +253,8 @@ are called before and after the processing of each attachment), and the
attachment-specific `before_<attachment>_post_process` and
`after_<attachment>_post_process`. The callbacks are intended to be as close to
normal ActiveRecord callbacks as possible, so if you return false (specifically
\- returning nil is not the same) in a before\_ filter, the post processing step
will halt. Returning false in an after\_ filter will not halt anything, but you
\- returning nil is not the same) in a `before_filter`, the post processing step
will halt. Returning false in an `after_filter will not halt anything, but you
can access the model and the attachment if necessary.

_NOTE: Post processing will not even *start* if the attachment is not valid
Expand All @@ -261,9 +263,9 @@ called with valid attachments._

class Message < ActiveRecord::Base
has_attached_file :asset, styles: {thumb: "100x100#"}

before_post_process :skip_for_audio

def skip_for_audio
! %w(audio/ogg application/ogg).include?(asset_content_type)
end
Expand Down

0 comments on commit 5dba614

Please sign in to comment.