From 0c2a267bea7f3285d6fdbbb2e7963fe33c2a28d7 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Mon, 14 Feb 2022 11:53:40 +0000 Subject: [PATCH] Patch keyword arguments syntax in Paperclip error handling --- config/initializers/paperclip.rb | 7 +++++++ 1 file changed, 7 insertions(+) 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)