Class: AuthorFieldType
- Inherits:
-
FieldType
- Object
- FieldType
- AuthorFieldType
- Defined in:
- app/models/author_field_type.rb
Instance Attribute Summary collapse
-
#author_name ⇒ Object
Returns the value of attribute author_name.
Instance Method Summary collapse
- #data=(data_hash) ⇒ Object
- #field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
- #mapping ⇒ Object
Instance Attribute Details
#author_name ⇒ Object
Returns the value of attribute author_name.
2 3 4 |
# File 'app/models/author_field_type.rb', line 2 def @author_name end |
Instance Method Details
#data=(data_hash) ⇒ Object
7 8 9 10 |
# File 'app/models/author_field_type.rb', line 7 def data=(data_hash) data_hash[:author_name] = data_hash[:default_author_name] if data_hash.deep_symbolize_keys[:author_name].blank? @author_name = data_hash.deep_symbolize_keys[:author_name] end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
12 13 14 15 16 |
# File 'app/models/author_field_type.rb', line 12 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = field_item.data['author_name'] json end |
#mapping ⇒ Object
18 19 20 |
# File 'app/models/author_field_type.rb', line 18 def mapping {author_name: mapping_field_name, type: :string, analyzer: :snowball} end |