24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/carrierwave_direct/validations/active_model.rb', line 24
def validate_each(record, attribute, value)
if record.send("has_#{attribute}_upload?") && record.key !~ record.send(attribute).key_regexp
extensions = record.send(attribute).extension_white_list
message = I18n.t("errors.messages.carrierwave_direct_filename_invalid")
if extensions.present?
message += I18n.t("errors.messages.carrierwave_direct_allowed_extensions", :extensions => extensions.to_sentence)
end
record.errors.add(attribute, message)
end
end
|