Sha256: f860b41dc4cbadd3fb1cda23ed3b19c300a3cb88c32d7a63da55723c1ff4938f

Contents?: true

Size: 653 Bytes

Versions: 44

Compression:

Stored size: 653 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # A module to deal with attributes associated with attachments allowing
  # deletions with remove_attribute_name
  module AttachmentAttributesMethods
    private

    # This method set the attributes to assign. The attribute is included if a
    # value exists in the form or remove_[attribute_name] is true in the form
    # (in this case the value is nil)
    def attachment_attributes(*attrs)
      attrs.each_with_object({}) do |attribute, attributes|
        attributes[attribute] = form.send(attribute) if form.try("remove_#{attribute}") || form.send(attribute).present?
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
decidim-core-0.29.1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.4 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.9 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.29.0 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.3 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.8 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.29.0.rc4 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.29.0.rc3 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.29.0.rc2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.29.0.rc1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.7 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.6 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.10 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.9 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.0 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.5 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.0.rc5 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.28.0.rc4 app/commands/decidim/attachment_attributes_methods.rb