Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Doc changes

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@395 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information...
commit 0544f0f9e82144cf200f264ea59020a690d57a33 1 parent 830c0aa
jyurek authored
View
2  README
@@ -1,6 +1,6 @@
=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 much like other attributes as possible. This means they aren't saved to their final locations on disk, nor are they deleted if set to nil, until ActiveRecord::Base#save is called. It manages validations based on size and presence, if requires. It can transform its assigned image into thumbnails if needed, and the setup for that is as simple as installing ImageMagick (which, for most modern Unix-based systems, is as easy as installing the right packages). Attached files are saved to the filesystem and referenced in the browser by an easily understandable specification, which has sensible and useful defaults.
+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 much like other attributes as possible. This means they aren't saved to their final locations on disk, nor are they deleted if set to nil, until ActiveRecord::Base#save is called. It manages validations based on size and presence, if required. It can transform its assigned image into thumbnails if needed, and the prerequisites are as simple as installing ImageMagick (which, for most modern Unix-based systems, is as easy as installing the right 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 the +has_attached_file+ method for options.
View
8 lib/paperclip.rb
@@ -31,6 +31,7 @@
require 'paperclip/thumbnail'
require 'paperclip/attachment'
+# The base module that gets included in ActiveRecord::Base.
module Paperclip
class << self
# Provides configurability to Paperclip. There are a number of options available, such as:
@@ -136,9 +137,10 @@ def has_attached_file name, options = {}
end
# Places ActiveRecord-style validations on the size of the file assigned. The
- # possible options are :in, which takes a Range of bytes (i.e. +1..1.megabyte+),
- # :less_than, which is equivalent to :in => 0..options[:less_than], and
- # :greater_than, which is equivalent to :in => options[:greater_than]..Infinity
+ # possible options are:
+ # * +in+: a Range of bytes (i.e. +1..1.megabyte+),
+ # * +less_than+: equivalent to :in => 0..options[:less_than]
+ # * +greater_than+: equivalent to :in => options[:greater_than]..Infinity
def validates_attachment_size name, options = {}
@attachment_definitions[name][:validations] << lambda do |attachment, instance|
unless options[:greater_than].nil?
View
2  lib/paperclip/attachment.rb
@@ -1,4 +1,6 @@
module Paperclip
+ # The Attachment class manages the files for a given attachment. It saves when the model saves,
+ # deletes when the model is destroyed, and processes the file upon assignment.
class Attachment
attr_reader :name, :instance, :file, :styles, :default_style
View
1  lib/paperclip/thumbnail.rb
@@ -1,4 +1,5 @@
module Paperclip
+ # Handles thumbnailing images that are uploaded.
class Thumbnail
attr_accessor :file, :current_geometry, :target_geometry, :format, :whiny_thumbnails
Please sign in to comment.
Something went wrong with that request. Please try again.