I can’t find any docs about attachment validations. Are there any? If not, will it be added?
Given that the Rails guide
Action View Form Helpers — Ruby on Rails Guides
references external (non-rails) gems for managing uploaded files I'd guess the answer to both those is no
Seems like a worthwhile gem idea, though.
The new ActiveStorage framework in Rails 5.2 provide just that, I just cant find anything about validating them.
The initial release of Active Storage (as part of Rails 5.2) did not include the ability to validate attachments.
Validations are intended to be a part of the Rails 6 release. Work to support this has already begun.
In the meantime, if you need validations for Active Storage attachments right now, you can roll your own using custom validators. I have written a few blog posts on the subject that you might find helpful:
- Adding an Attachment Validator to Active Storage
- Validating the Content-Type of Active Storage Attachments
Hope that helps!