Class: Iron::FieldDefinition

Inherits:
ApplicationRecord show all
Includes:
Exportable, Importable, Ranked, Searchable
Defined in:
app/models/iron/field_definition.rb

Defined Under Namespace

Modules: Exportable, Importable, Ranked, Searchable

Constant Summary collapse

TYPES =
%w[text_field text_area rich_text_area number file boolean date block block_list reference_list reference].freeze
RESERVED_HANDLES =
%w[id base _metadata _type].freeze

Constants included from Searchable

Searchable::SEARCHABLE_TYPES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Searchable

#reindex_entries, #searchable, #searchable=, #searchable?

Methods included from Exportable

#export_attributes

Class Method Details

.classify_type(type) ⇒ Object



20
21
22
# File 'app/models/iron/field_definition.rb', line 20

def classify_type(type)
  "Iron::FieldDefinitions::#{type.classify}"
end

Instance Method Details

#field_typeObject



33
34
35
# File 'app/models/iron/field_definition.rb', line 33

def field_type
  "Iron::Fields::#{type.demodulize}"
end

#humanized_typeObject



25
26
27
# File 'app/models/iron/field_definition.rb', line 25

def humanized_type
  type.demodulize.humanize
end

#type_handleObject



29
30
31
# File 'app/models/iron/field_definition.rb', line 29

def type_handle
  type.demodulize.underscore
end

#value_columnObject



37
38
39
# File 'app/models/iron/field_definition.rb', line 37

def value_column
  raise "value_column not implemented by '#{type}'"
end