Class: RailsAdmin::Config::Fields::Types::MultipleFileUpload

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_admin/config/fields/types/multiple_file_upload.rb

Direct Known Subclasses

MultipleActiveStorage, MultipleCarrierwave

Defined Under Namespace

Classes: AbstractAttachment

Constant Summary

Constants inherited from Base

Base::NAMED_INSTANCE_VARIABLES

Instance Attribute Summary

Attributes inherited from Base

#abstract_model, #defined, #name, #order, #parent, #properties, #root, #section

Instance Method Summary collapse

Methods inherited from Base

#association?, #editable?, #errors, #form_default_value, #form_value, #generic_field_help, #generic_help, #inverse_of, #method_name, #optional, #optional=, #optional?, #parse_input, #parse_value, #type, #type_css_class, #value

Methods included from Inspectable

#inspect

Methods included from Groupable

#group

Methods included from Hideable

#hidden?, #hide, included, #show

Methods included from Configurable

#has_option?, #register_deprecated_instance_option, #register_instance_option

Methods included from Proxyable

#bindings, #bindings=, #with

Constructor Details

#initialize(*args) ⇒ MultipleFileUpload

Returns a new instance of MultipleFileUpload.


55
56
57
58
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 55

def initialize(*args)
  super
  @attachment_configurations = []
end

Instance Method Details

#attachment(&block) ⇒ Object


102
103
104
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 102

def attachment(&block)
  @attachment_configurations << block
end

#attachmentsObject


106
107
108
109
110
111
112
113
114
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 106

def attachments
  Array(value).map do |attached|
    attachment = attachment_class.new(attached)
    @attachment_configurations.each do |config|
      attachment.instance_eval(&config)
    end
    attachment.with(bindings)
  end
end

#virtual?Boolean

virtual class

Returns:


117
118
119
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 117

def virtual?
  true
end