Skip to content

Commit

Permalink
Doc changes
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@395 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
  • Loading branch information
jyurek committed Mar 18, 2008
1 parent 830c0aa commit 0544f0f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion 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.

Expand Down
8 changes: 5 additions & 3 deletions lib/paperclip.rb
Expand Up @@ -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:
Expand Down Expand Up @@ -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?
Expand Down
2 changes: 2 additions & 0 deletions 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
Expand Down
1 change: 1 addition & 0 deletions 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
Expand Down

0 comments on commit 0544f0f

Please sign in to comment.