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
require 'fileutils'
unless Rails.env.development?
# force the whole app to use its own tmpdir
FileUtils.mkdir_p(Rails.root.join('tmp'))
ENV['TMPDIR'] = Rails.root.join('tmp').to_s
end