Class: UserFieldType
- Inherits:
-
FieldType
- Object
- FieldType
- UserFieldType
- Defined in:
- app/models/user_field_type.rb
Constant Summary collapse
- VALIDATION_TYPES =
{ presence: :valid_presence_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.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#validations ⇒ Object
Returns the value of attribute validations.
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.
6 7 8 |
# File 'app/models/user_field_type.rb', line 6 def data @data end |
#field_name ⇒ Object
Returns the value of attribute field_name.
6 7 8 |
# File 'app/models/user_field_type.rb', line 6 def field_name @field_name end |
#metadata ⇒ Object
Returns the value of attribute metadata.
7 8 9 |
# File 'app/models/user_field_type.rb', line 7 def end |
#user_id ⇒ Object
Returns the value of attribute user_id.
6 7 8 |
# File 'app/models/user_field_type.rb', line 6 def user_id @user_id end |
#validations ⇒ Object
Returns the value of attribute validations.
7 8 9 |
# File 'app/models/user_field_type.rb', line 7 def validations @validations end |
Instance Method Details
#acceptable_validations? ⇒ Boolean
24 25 26 |
# File 'app/models/user_field_type.rb', line 24 def acceptable_validations? valid_types? && end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
28 29 30 31 32 |
# File 'app/models/user_field_type.rb', line 28 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = field_item.data['user'] json end |
#mapping ⇒ Object
34 35 36 |
# File 'app/models/user_field_type.rb', line 34 def mapping {name: mapping_field_name, type: :string, analyzer: :snowball} end |