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.26.8 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.4 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.3 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.7 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.5 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.4 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.0 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.3 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.0.rc2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.27.0.rc1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.0 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.0.rc2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.26.0.rc1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.25.2 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.25.1 app/commands/decidim/attachment_attributes_methods.rb
decidim-core-0.25.0 app/commands/decidim/attachment_attributes_methods.rb