Sam Van Damme PRO said 29 days ago on Active Storage Validators :
Thank you for the video, really interesting! 
One remark is that when you update another attribute on the Movie that has nothing to do with the poster image, the poster image will still be loaded to make the validations. Any idea how we could avoid this?

Thanks

kjdelys PRO said about 10 hours ago on Active Storage Validators :
Hey,
file_size_validator won't work with has_many_attached.

You need to update it to something like

if value.class == ActiveStorage::Attached::Many
  return if value.all? { |file| file.blob.byte_size < options[:less_than].megabytes }
else
  return if value.blob.byte_size < options[:less_than].megabytes
end

Login to Comment