Sha256: 54315bf5c0f7955d12d1e54e0426799c8958fdfff1f926162d2c5b0b2785a615

Contents?: true

Size: 394 Bytes

Versions: 1

Compression:

Stored size: 394 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A form object used to create attachments.
  #
  class AttachmentForm < Form
    attribute :title, String
    attribute :file

    mimic :attachment

    validates :title, presence: true, if: ->(form) { form.file.present? }
    validates :file, file_size: { less_than_or_equal_to: ->(_attachment) { Decidim.maximum_attachment_size } }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
decidim-core-0.22.0 app/forms/decidim/attachment_form.rb