Add File Validation concern after refactoring

This commit is contained in:
Ismael MOUSSA S 2021-09-20 19:51:20 +02:00 committed by Pierre de La Morinerie
parent 7c7c9c9ea4
commit 36dc9c2ca2
7 changed files with 28 additions and 37 deletions

View file

@ -0,0 +1,8 @@
module FileValidationConcern
extend ActiveSupport::Concern
class_methods do
def file_size_validation(file_max_size = 200.megabytes)
{ less_than: file_max_size, message: I18n.t('errors.messages.file_size_out_of_range', file_size_limit: ActiveSupport::NumberHelper.number_to_human_size(file_max_size)) }
end
end
end