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?, #eager_load_values, #editable?, #errors, #filter_options, #form_default_value, #form_value, #generic_field_help, #generic_help, #inverse_of, #method_name, #optional, #optional=, #optional?, #parse_input, #parse_value, #sort_column, #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.



59
60
61
62
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 59

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

Instance Method Details

#attachment(&block) ⇒ Object



106
107
108
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 106

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

#attachmentsObject



110
111
112
113
114
115
116
117
118
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 110

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:



121
122
123
# File 'lib/rails_admin/config/fields/types/multiple_file_upload.rb', line 121

def virtual?
  true
end