Is anyone working on ActiveStorage validation?

https://github.com/rails/rails/pull/33303 hinted at validation a while ago, but I haven’t seen anything on the topic since.

Is anyone currently working on this? If not, would anyone be opposed to me having a go at it?

2 Likes

I’m using this gem https://github.com/igorkasyanchuk/active_storage_validations

1 Like

Steps to reproduce

Create model like:

class Project < ApplicationRecord has_one_attached :attachment end Toys R Us Credit Card

There is no way to validate if the attachment is present or check its content type, etc. If you need - you need to write own validates :some_method code.

Yep, I think having some builtin validations for content type etc would be very helpful. I think paperclip does this reasonably well and it would be nice for Active Storage to do the same. For beginner users it’s a bit risk to not validate attachments at all because it’s too hard.