diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index c2b04b98b5..a58c6bdf9d 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -36,4 +36,11 @@ module UpdatedUrlGenerator end end +module PaperclipImageErrors + def mark_invalid(record, attribute, types) + record.errors.add attribute, :invalid, **options.merge(:types => types.join(', ')) + end +end + Paperclip::UrlGenerator.prepend(UpdatedUrlGenerator) +Paperclip::Validators::AttachmentPresenceValidator.prepend(PaperclipImageErrors)