Class: Iron::FieldDefinition
Defined Under Namespace
Modules: Exportable, Importable, Ranked, Searchable, Validatable, Validations
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 _file].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?
#metadata=, #required?
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
#bump_schema_revision(_record) ⇒ Object
Bumps updated_at so caches keyed on it — the OpenAPI/MCP schema — refresh
when a habtm edit changes the generated schema without touching a column.
27
28
29
|
# File 'app/models/iron/field_definition.rb', line 27
def bump_schema_revision(_record)
touch if persisted?
end
|
#field_type ⇒ Object
39
40
41
|
# File 'app/models/iron/field_definition.rb', line 39
def field_type
"Iron::Fields::#{type.demodulize}"
end
|
#humanized_type ⇒ Object
31
32
33
|
# File 'app/models/iron/field_definition.rb', line 31
def humanized_type
type.demodulize.humanize
end
|
#type_handle ⇒ Object
35
36
37
|
# File 'app/models/iron/field_definition.rb', line 35
def type_handle
type.demodulize.underscore
end
|
#value_column ⇒ Object
43
44
45
|
# File 'app/models/iron/field_definition.rb', line 43
def value_column
raise "value_column not implemented by '#{type}'"
end
|