active_storage_validations icon indicating copy to clipboard operation
active_storage_validations copied to clipboard

Validate total size of attachments in case of has_many relationship

Open a-moreira opened this issue 3 years ago • 5 comments

This is a great gem, thanks a lot. As far as I understand, it's not possible to validate the total file size (summation of each file size) in case we have a has_many relationship. For example, I have the following contraint:

  • upload some documents summing up to 10MB in size, each document with max 1MB each.

Currently I'm validating manually in the Model, but it'd be useful to have this in the gem as well.

I can try to implement it with some guidance.

a-moreira avatar Apr 16 '21 22:04 a-moreira

Hi @a-moreira, Thanks for raising this issue. It seems like a nice addition to the gem. I can guide you on how to implement it, or I can do it myself if you are too busy right now. Let me know!

Mth0158 avatar Dec 01 '23 17:12 Mth0158

hey @Mth0158, thanks for the reply. I'm busy right now so feel free to implement it :-)

a-moreira avatar Dec 06 '23 05:12 a-moreira

Hi! Any updates on this feature? @Mth0158

mattiasgullstrand avatar Feb 16 '24 10:02 mattiasgullstrand

Hi, @mattiasgullstrand I am busy these days, maybe I will find some time to implement it, but I can't say when... It would be a nice addition to the gem though, feel free to assign it to yourself if you want to work on it :)

Mth0158 avatar Feb 16 '24 12:02 Mth0158

Thanks @Mth0158. I see, and I agree, would be a nice addition! But not sure that I will have time anytime soon either

mattiasgullstrand avatar Feb 19 '24 10:02 mattiasgullstrand