Commit deff9cf5 by Chad Pytel

convert the readme to markdown and add proper trademark and license info

parent 7a38ef79
=Paperclip
Paperclip
=========
Paperclip is intended as an easy file attachment library for ActiveRecord. The
intent behind it was to keep setup as easy as possible and to treat files as
......@@ -12,24 +13,24 @@ packages). Attached files are saved to the filesystem and referenced in the
browser by an easily understandable specification, which has sensible and
useful defaults.
See the documentation for +has_attached_file+ in Paperclip::ClassMethods for
See the documentation for `has_attached_file` in Paperclip::ClassMethods for
more detailed options.
The complete RDoc[http://rdoc.info/gems/paperclip] is online.
==Installation
Installation
------------
Include the gem in your Gemfile:
gem "paperclip", "~> 2.3"
==Installation
As a plugin:
Or as a plugin:
ruby script/plugin install git://github.com/thoughtbot/paperclip.git
==Quick Start
Quick Start
-----------
In your model:
......@@ -73,15 +74,16 @@ In your show view:
<%= image_tag @user.avatar.url(:medium) %>
<%= image_tag @user.avatar.url(:thumb) %>
==Usage
Usage
-----
The basics of paperclip are quite simple: Declare that your model has an
attachment with the has_attached_file method, and give it a name. Paperclip
will wrap up up to four attributes (all prefixed with that attachment's name,
so you can have multiple attachments per model if you wish) and give the a
friendly front end. The attributes are <attachment>_file_name,
<attachment>_file_size, <attachment>_content_type, and <attachment>_updated_at.
Only <attachment>_file_name is required for paperclip to operate. More
friendly front end. The attributes are `<attachment>_file_name`,
`<attachment>_file_size`, `<attachment>_content_type`, and `<attachment>_updated_at`.
Only `<attachment>_file_name` is required for paperclip to operate. More
information about the options to has_attached_file is available in the
documentation of Paperclip::ClassMethods.
......@@ -89,7 +91,8 @@ Attachments can be validated with Paperclip's validation methods,
validates_attachment_presence, validates_attachment_content_type, and
validates_attachment_size.
==Storage
Storage
-------
The files that are assigned as attachments are, by default, placed in the
directory specified by the :path option to has_attached_file. By default, this
......@@ -101,8 +104,8 @@ file at
/data/myapp/releases/20081229172410/public/system/avatars/13/small/my_pic.png
NOTE: This is a change from previous versions of Paperclip, but is overall a
safer choice for the default file store.
_NOTE: This is a change from previous versions of Paperclip, but is overall a
safer choice for the default file store._
You may also choose to store your files using Amazon's S3 service. You can find
more information about S3 storage at the description for
......@@ -115,7 +118,8 @@ both the :path and :url options in order to make sure the files are unavailable
to the public. Both :path and :url allow the same set of interpolated
variables.
==Post Processing
Post Processing
---------------
Paperclip supports an extensible selection of post-processors. When you define
a set of styles for an attachment, by default it is expected that those
......@@ -156,10 +160,11 @@ then both the :rotator processor and the :ocr processor would receive the
options "{ :quality => :better }". This parameter may not mean anything to one
or more or the processors, and they are expected to ignore it.
NOTE: Because processors operate by turning the original attachment into the
styles, no processors will be run if there are no styles defined.
_NOTE: Because processors operate by turning the original attachment into the
styles, no processors will be run if there are no styles defined._
==Events
Events
------
Before and after the Post Processing step, Paperclip calls back to the model
with a few callbacks, allowing the model to change or cancel the processing
......@@ -172,16 +177,18 @@ normal ActiveRecord callbacks as possible, so if you return false (specifically
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
_NOTE: Post processing will not even *start* if the attachment is not valid
according to the validations. Your callbacks and processors will *only* be
called with valid attachments.
called with valid attachments._
==Testing
Testing
-------
Paperclip provides rspec-compatible matchers for testing attachments. See the
documentation on Paperclip::Shoulda::Matchers for more information.
==Contributing
Contributing
------------
If you'd like to contribute a feature or bugfix: Thanks! To make sure your
fix/feature has a high chance of being included, please read the following
......@@ -192,3 +199,17 @@ guidelines:
2. Make sure there are tests! We will not accept any patch that is not tested.
It's a rare time when explicit tests aren't needed. If you have questions
about writing tests for paperclip, please ask the mailing list.
Credits
-------
![thoughtbot](http://thoughtbot.com/images/tm/logo.png)
Paperclip is maintained and funded by [thoughtbot, inc](http://thoughtbot.com/community)
The names and logos for thoughtbot are trademarks of thoughtbot, inc.
License
-------
Paperclip is Copyright © 2008-2011 thoughtbot. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
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