igorkasyanchuk/active_storage_validations
Do it like => validates :photos, attached: true, content_type: ['image/png', 'image/jpg', 'image/jpeg'], size: { less_than: 500.kilobytes }, limit: { min: 1, max: 3 }, aspect_ratio: :landscape, dimension: { width: { in: 800..1600 } observed · 2026-09-03
Health v2 · maintenance only
95/100
- Activity 100
- Release rhythm 86
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 36.5
- age_days: 2927
- days_rel: 14
- days_push: 0
- n_releases_24m: 19
Adoption not part of the score
1191 stars · 151 forks observed · 2026-09-03
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
A Ruby gem that adds validations for Rails Active Storage attachments, such as attached presence, content type, file size, dimensions, aspect ratio, duration, and page count. It includes I18n error messages and RSpec/MiniTest test matchers.
Use cases
- validate that an avatar attachment is present and is a PNG or JPEG
- limit number of uploaded photos to between 1 and 3
- enforce max file size on uploads
- check image dimensions and aspect ratio before accepting uploads
- validate video or audio duration in Active Storage
- prevent content type spoofing on uploaded files
- test attachment validations in Rails test suites
When to choose
- you use Rails Active Storage and need declarative attachment validations
- you want built-in I18n error messages for upload validation failures
- you need metadata checks like image dimensions, aspect ratio, or media duration
When to avoid
- you are not using Rails or Active Storage
- you need validation of files stored outside Active Storage
- you need a general-purpose file processing pipeline rather than validation
Facets
library · maturity stable
form-handling file-upload image-processing testing web-development backend files developer-tools ruby cross-platform rails active-storage activerecord gem file-validation i18n test-matchers web-server
2 sources
- readme: https://github.com/igorkasyanchuk/active_storage_validations · fetched 2026-09-03 · 56b31572df1c
- homepage: https://www.railsjazz.com/ · fetched 2026-08-29 · 08fc0beb8ec8
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| igorkasyanchuk/active_storage_validations | main | 95 |
For agents
markdown · JSON · MCP: product_card(name="igorkasyanchuk/active_storage_validations")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem