Sha256: 43668b9b3b683740f2d1a1abfb64a53c38ef6c0a8c627b390d2b8ec8915983f4
Contents?: true
Size: 891 Bytes
Versions: 1
Compression:
Stored size: 891 Bytes
Contents
# frozen_string_literal: true module Decidim # A module with all the attachment common methods module AttachmentMethods private def build_attachment @attachment = Attachment.new( title: @form.attachment.title, file: @form.attachment.file, attached_to: @attached_to ) end def attachment_invalid? if attachment.invalid? && attachment.errors.has_key?(:file) @form.attachment.errors.add :file, attachment.errors[:file] true end end def attachment_present? @form.attachment.file.present? end def create_attachment attachment.attached_to = @attached_to attachment.save! end def attachments_allowed? @form.current_component.settings.attachments_allowed? end def process_attachments? attachments_allowed? && attachment_present? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
decidim-core-0.22.0 | app/commands/decidim/attachment_methods.rb |