Category guides

File uploads in Rails: Active Storage, Shrine and CarrierWave

Category guides · · Published 2026-10-24

A white USB stick, a small black USB drive and three memory cards on a grey surface
A USB stick, a small drive and memory cards on a grey desk.

Avatars, invoices, product photos: attachments look simple until you need cloud storage, thumbnails, direct uploads and validation. Rails has handled this itself since 5.2, but the two leading gems remain good choices for particular needs.

Release figures are from RubyGems.org, October 2026.

Active Storage

Active Storage, part of Rails since version 5.2, attaches files to Active Record models through two tables, active_storage_blobs and active_storage_attachments, so you do not add columns to your own models:

class User < ApplicationRecord
  has_one_attached :avatar do |attachable|
    attachable.variant :thumb, resize_to_limit: [200, 200]
  end
  has_many_attached :documents
end

Files are stored through configurable services: local disk, Amazon S3 and S3-compatible services, or Google Cloud Storage, with a mirror service for migrations. Direct uploads let the browser send files straight to the storage service, which keeps large uploads out of your application servers. Variants (resized or converted images) are produced on demand by the image_processing gem, using libvips by default in new applications, and previews can be generated for PDFs and videos with the right system tools installed.

The Active Storage Overview guide is thorough and worth reading end to end.

Limits to know: Active Storage does not validate content type or size out of the box; you need your own validation or a gem such as active_storage_validations. Its polymorphic tables make some queries less direct than a column on the model. And variants are processed lazily on first request unless you configure them to be processed in advance.

Choose it when you are starting a new application and your needs are typical. It is maintained with the framework and supported by most of the ecosystem, including admin panels and Action Text.

Shrine

Shrine (3.10.2, October 2026) is a toolkit built from small plugins. You enable only what you need: derivatives (processed versions), validation helpers, metadata extraction, backgrounding, presigned direct uploads, resumable uploads with tus, and more. It works with Active Record, Sequel or plain Ruby objects, and it stores attachment data in a single JSON column on your own table.

Shrine's documentation is excellent and explains the trade-offs of each approach to uploading, which makes it instructive even if you end up using Active Storage.

Choose it when you need fine control over the upload pipeline, want validation and processing as first-class concepts, or work outside Rails models.

CarrierWave

CarrierWave (3.1.4, August 2026) organises uploads in uploader classes that you mount on a model column. Versions are defined in the uploader, and storage goes through the local filesystem or Fog-based cloud providers. It predates Active Storage, remains maintained and is common in applications started in the 2010s.

Choose it when you maintain an application that already uses it. For new work, Active Storage or Shrine are more usual starting points.

Paperclip and its fork

Paperclip was the dominant attachment library of the Rails 3 era. Thoughtbot deprecated it in 2018 and recommended Active Storage for new projects; its last release, 6.1.0, dates from July 2018. A community fork, kt-paperclip, continues to publish releases (8.0.1 in October 2026) for applications that cannot migrate yet. Our note on Paperclip covers its history and the migration paths.

Older still, attachment_fu was the standard plugin of the Rails 2 years; it is long abandoned.

Security and operations checklist

Summary

LibraryData modelStrength
Active StorageTwo shared tablesBuilt in, widely supported
ShrineJSON column on your tableModular, explicit pipeline
CarrierWaveString column plus uploader classMature, familiar in older apps
kt-paperclipColumns on your tableBridge for legacy Paperclip apps