explaingit

thoughtbot/paperclip

9,015RubyAudience · developerComplexity · 2/5Setup · moderate

TLDR

A now-deprecated Ruby on Rails library for attaching uploaded files to database records, with automatic image resizing via ImageMagick and cloud storage support, replaced by Rails' built-in ActiveStorage.

Mindmap

mindmap
  root((Paperclip))
    Status
      Deprecated
      No new PRs
    Features
      File attachments
      Image resizing
      Cloud storage
    Integration
      Ruby on Rails
      ImageMagick
      S3 compatible
    Migration
      ActiveStorage
      kt-paperclip fork
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Understand how file attachments work in a legacy Rails app that still uses Paperclip.

USE CASE 2

Follow the official migration guide to move a Paperclip-based Rails app to ActiveStorage.

USE CASE 3

Use the kt-paperclip community fork to get bug fixes for a project that cannot migrate immediately.

USE CASE 4

Learn how file attachment libraries handle image resizing, storage backends, and URL generation in Rails.

Tech stack

RubyRails

Getting it running

Difficulty · moderate Time to first run · 30min

Deprecated, use Rails ActiveStorage for new projects, ImageMagick must be installed separately for image resizing.

In plain English

Paperclip was a Ruby library for attaching files to database records in web applications built with Ruby on Rails. The idea was to treat uploaded files like any other piece of data, so you could attach a profile photo to a user or a PDF to an invoice with just a few lines of configuration. Files were not written to disk until the database record itself was saved, which kept the behavior consistent with how other fields work in the Rails data layer. Beyond basic uploads, Paperclip could automatically resize images into multiple sizes, called "styles," using ImageMagick, a widely available image-processing tool. For example, you might define a "thumb" and a "medium" version of every uploaded photo, and Paperclip would generate both on upload. It also validated files by size, type, and actual content, catching attempts to upload files that claimed to be images but were actually something else entirely. Files could be stored locally on the server's filesystem or sent to a cloud storage service. The library generated URLs for stored files based on a configurable template, and included helper methods that made it straightforward to display images or link to downloads from HTML views. Setting it up in a Rails project required adding a few extra columns to a database table, one declaration on the model, and a file input in the form. The library handled the rest: saving the file, cleaning up when the record was deleted, and building the correct path for each attachment style. As of today, this project is no longer actively maintained. The original team at thoughtbot officially deprecated Paperclip and recommends that new Rails projects use ActiveStorage, which ships as part of Rails itself. For existing projects still relying on Paperclip, the team wrote a migration guide available in both English and Spanish, and a community-maintained fork called kt-paperclip continues to accept bug reports. No new pull requests to the original repository are being accepted. The full README is longer than what was shown.

Copy-paste prompts

Prompt 1
I have a Rails app using Paperclip for file uploads and I want to migrate to ActiveStorage. Walk me through the migration step by step.
Prompt 2
My Rails app uses Paperclip with Amazon S3 storage. What changes do I need to make to move to ActiveStorage pointing at the same S3 bucket?
Prompt 3
Explain how Paperclip image styles and resizing work so I can replicate the same thumbnail behavior using ActiveStorage after migrating.
Prompt 4
I found a Paperclip attachment declaration in a Rails model. What database columns does it add, how does it generate file URLs, and how does deletion work?
Open on GitHub → Explain another repo

← thoughtbot on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.