rails-active-storage

Installation
SKILL.md

Rails Active Storage

Attachment Types

  • Use has_one_attached :avatar for single file fields
  • Use has_many_attached :documents for collections
  • Prefer descriptive names (e.g., profile_picture over image)

Validations

  • Active Storage does not include file validations out of the box
  • Validate presence, content type, and file size manually using custom validation methods
  • Check avatar.attached? for presence and avatar.blob.content_type for format

Image Processing

  • Use variant(resize_to_limit: [...]) for resizing
  • Guard with representable? before calling .variant on non-image blobs
  • Always check attached? before rendering
Installs
2
First Seen
May 8, 2026
rails-active-storage — gierd-inc/dev-skills