Module: RailsAdmin::Config::Fields::Types

Defined in:
lib/rails_admin/config/fields/types.rb,
lib/rails_admin/config/fields/types/date.rb,
lib/rails_admin/config/fields/types/enum.rb,
lib/rails_admin/config/fields/types/inet.rb,
lib/rails_admin/config/fields/types/json.rb,
lib/rails_admin/config/fields/types/text.rb,
lib/rails_admin/config/fields/types/time.rb,
lib/rails_admin/config/fields/types/uuid.rb,
lib/rails_admin/config/fields/types/color.rb,
lib/rails_admin/config/fields/types/float.rb,
lib/rails_admin/config/fields/types/citext.rb,
lib/rails_admin/config/fields/types/froala.rb,
lib/rails_admin/config/fields/types/hidden.rb,
lib/rails_admin/config/fields/types/shrine.rb,
lib/rails_admin/config/fields/types/string.rb,
lib/rails_admin/config/fields/types/boolean.rb,
lib/rails_admin/config/fields/types/decimal.rb,
lib/rails_admin/config/fields/types/integer.rb,
lib/rails_admin/config/fields/types/numeric.rb,
lib/rails_admin/config/fields/types/datetime.rb,
lib/rails_admin/config/fields/types/password.rb,
lib/rails_admin/config/fields/types/ck_editor.rb,
lib/rails_admin/config/fields/types/dragonfly.rb,
lib/rails_admin/config/fields/types/paperclip.rb,
lib/rails_admin/config/fields/types/timestamp.rb,
lib/rails_admin/config/fields/types/wysihtml5.rb,
lib/rails_admin/config/fields/types/serialized.rb,
lib/rails_admin/config/fields/types/simple_mde.rb,
lib/rails_admin/config/fields/types/action_text.rb,
lib/rails_admin/config/fields/types/carrierwave.rb,
lib/rails_admin/config/fields/types/code_mirror.rb,
lib/rails_admin/config/fields/types/file_upload.rb,
lib/rails_admin/config/fields/types/string_like.rb,
lib/rails_admin/config/fields/types/active_storage.rb,
lib/rails_admin/config/fields/types/bson_object_id.rb,
lib/rails_admin/config/fields/types/active_record_enum.rb,
lib/rails_admin/config/fields/types/has_one_association.rb,
lib/rails_admin/config/fields/types/has_many_association.rb,
lib/rails_admin/config/fields/types/multiple_carrierwave.rb,
lib/rails_admin/config/fields/types/multiple_file_upload.rb,
lib/rails_admin/config/fields/types/belongs_to_association.rb,
lib/rails_admin/config/fields/types/multiple_active_storage.rb,
lib/rails_admin/config/fields/types/polymorphic_association.rb,
lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb

Defined Under Namespace

Classes: ActionText, ActiveRecordEnum, ActiveStorage, BelongsToAssociation, Boolean, BsonObjectId, CKEditor, Carrierwave, Citext, CodeMirror, Color, Date, Datetime, Decimal, Dragonfly, Enum, FileUpload, Float, Froala, HasAndBelongsToManyAssociation, HasManyAssociation, HasOneAssociation, Hidden, Inet, Integer, Json, MultipleActiveStorage, MultipleCarrierwave, MultipleFileUpload, Numeric, Paperclip, Password, PolymorphicAssociation, Serialized, Shrine, SimpleMDE, String, StringLike, Text, Time, Timestamp, Uuid, Wysihtml5

Constant Summary collapse

@@registry =
{}

Class Method Summary collapse

Class Method Details

.load(type) ⇒ Object



13
14
15
# File 'lib/rails_admin/config/fields/types.rb', line 13

def self.load(type)
  @@registry.fetch(type.to_sym) { raise "Unsupported field datatype: #{type}" }
end

.register(type, klass = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/rails_admin/config/fields/types.rb', line 17

def self.register(type, klass = nil)
  if klass.nil? && type.is_a?(Class)
    klass = type
    type = klass.name.to_s.demodulize.underscore
  end
  @@registry[type.to_sym] = klass
end