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 }
https://www.railsjazz.com/
MIT License
1k stars 129 forks source link

ActiveAdmin and active_storage_validations #95

Open PSM8493 opened 3 years ago

PSM8493 commented 3 years ago

This Gem is great. i'm using it for a front end form which is perfect.

I'm also using it for the Admin part of my App using activeadmin gem.

I get validation error message in ActiveAdmin but it saves the file and ignores the validations

validates :images, content_type: ['image/png', 'image/jpg', 'image/jpeg'], limit: { min: 1, max: 2, message: 'You are allowed a maximum of 2 attachments' }, size: { less_than: 200.kilobytes , message: 'The attachment(s) must be less than 200kb' }

Would be great if you could give some pointers. Really stuck :-( This is a similar issue with another gem

https://github.com/aki77/activestorage-validator/issues/1

Thank you

igorkasyanchuk commented 3 years ago

Sorry, can't help now with this issue. I'm not a fan of ActiveAdmin and never used it. Maybe you can contribute to it