Class: TreeFieldType
- Inherits:
-
FieldType
- Object
- FieldType
- TreeFieldType
- Defined in:
- app/models/tree_field_type.rb
Constant Summary collapse
- VALIDATION_TYPES =
{ presence: :valid_presence_validation?, maximum: :valid_maximum_validation?, minimum: :valid_minimum_validation? }.freeze
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#validations ⇒ Object
Returns the value of attribute validations.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #acceptable_validations? ⇒ Boolean
- #field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
- #mapping ⇒ Object
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
8 9 10 |
# File 'app/models/tree_field_type.rb', line 8 def data @data end |
#field_name ⇒ Object
Returns the value of attribute field_name.
8 9 10 |
# File 'app/models/tree_field_type.rb', line 8 def field_name @field_name end |
#metadata ⇒ Object
Returns the value of attribute metadata.
9 10 11 |
# File 'app/models/tree_field_type.rb', line 9 def end |
#validations ⇒ Object
Returns the value of attribute validations.
9 10 11 |
# File 'app/models/tree_field_type.rb', line 9 def validations @validations end |
#values ⇒ Object
Returns the value of attribute values.
8 9 10 |
# File 'app/models/tree_field_type.rb', line 8 def values @values end |
Instance Method Details
#acceptable_validations? ⇒ Boolean
33 34 35 |
# File 'app/models/tree_field_type.rb', line 33 def acceptable_validations? valid_types? && end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
37 38 39 40 41 |
# File 'app/models/tree_field_type.rb', line 37 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = field_item.data['tree'] json end |
#mapping ⇒ Object
43 44 45 |
# File 'app/models/tree_field_type.rb', line 43 def mapping { name: mapping_field_name, type: :string, analyzer: :snowball } end |