Last Modified
2013-07-16 08:44:00 +0000
Requires
  • erb
  • digest
  • tempfile
  • paperclip/version
  • paperclip/geometry_parser_factory
  • paperclip/geometry_detector_factory
  • paperclip/geometry
  • paperclip/processor
  • paperclip/tempfile
  • paperclip/thumbnail
  • paperclip/interpolations/plural_cache
  • paperclip/interpolations
  • paperclip/tempfile_factory
  • paperclip/style
  • paperclip/attachment
  • paperclip/attachment_options
  • paperclip/storage
  • paperclip/callbacks
  • paperclip/file_command_content_type_detector
  • paperclip/content_type_detector
  • paperclip/glue
  • paperclip/errors
  • paperclip/missing_attachment_styles
  • paperclip/validators
  • paperclip/instance_methods
  • paperclip/logger
  • paperclip/helpers
  • mime/types
  • logger
  • cocaine
  • paperclip/railtie
  • paperclip/io_adapters/registry
  • paperclip/io_adapters/abstract_adapter
  • paperclip/io_adapters/identity_adapter
  • paperclip/io_adapters/file_adapter
  • paperclip/io_adapters/stringio_adapter
  • paperclip/io_adapters/nil_adapter
  • paperclip/io_adapters/attachment_adapter
  • paperclip/io_adapters/uploaded_file_adapter
  • paperclip/io_adapters/uri_adapter

Description

Paperclip allows file attachments that are stored in the filesystem. All graphical transformations are done using the Graphics/ImageMagick command line utilities and are stored in Tempfiles until the record is saved. Paperclip does not require a separate model for storing the attachment's information, instead adding a few simple columns to your table.

Author

Jon Yurek

Copyright

Copyright (c) 2008-2011 thoughtbot, inc.

License

MIT License (www.opensource.org/licenses/mit-license.php)

Paperclip defines an attachment as any file, though it makes special considerations for image files. You can declare that a model has an attached file with the has_attached_file method:

class User < ActiveRecord::Base
  has_attached_file :avatar, :styles => { :thumb => "100x100" }
end

user = User.new
user.avatar = params[:user][:avatar]
user.avatar.url
# => "/users/avatars/4/original_me.jpg"
user.avatar.url(:thumb)
# => "/users/avatars/4/thumb_me.jpg"

See the has_attached_file documentation for more details.