ActiveStorage validations

I can’t find any docs about attachment validations. Are there any? If not, will it be added?

Given that the Rails guide

references external (non-rails) gems for managing uploaded files
I'd guess the answer to both those is no :slight_smile:

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:

Hope that helps!