From bd00b49275fd4af5f3b9a1dc235464556d1b3cd3 Mon Sep 17 00:00:00 2001 From: Joonas Date: Mon, 30 Dec 2024 12:12:48 +0200 Subject: [PATCH] Add missing attributes for image --- app/commands/concerns/decidim/ideas/image_methods.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/commands/concerns/decidim/ideas/image_methods.rb b/app/commands/concerns/decidim/ideas/image_methods.rb index 95d8734..4b3e5bd 100644 --- a/app/commands/concerns/decidim/ideas/image_methods.rb +++ b/app/commands/concerns/decidim/ideas/image_methods.rb @@ -4,15 +4,19 @@ module Decidim module Ideas # A module with all the image attachment common methods module ImageMethods + include Decidim::AttachmentMethods + private def build_image - form_image = @form.add_images.compact_blank.first + form_image = @form.add_images.compact_blank + @image = Decidim::Ideas::Attachment.new( attached_to: @attached_to, # Keep first - title: { I18n.locale.to_s => form_image["title"] }, - file: form_image["file"], - weight: 0 + title: { I18n.locale.to_s => form_image.first }, + file: signed_id_for(form_image.last), + weight: 0, + content_type: content_type_for(form_image.last) ) end