Class: UserFieldType

Inherits:
FieldType
  • Object
show all
Defined in:
app/models/user_field_type.rb

Constant Summary collapse

VALIDATION_TYPES =
{
  presence: :valid_presence_validation?
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject

Returns the value of attribute data.



6
7
8
# File 'app/models/user_field_type.rb', line 6

def data
  @data
end

#field_nameObject

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

#metadataObject

Returns the value of attribute metadata.



7
8
9
# File 'app/models/user_field_type.rb', line 7

def 
  
end

#user_idObject

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

#validationsObject

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

Returns:

  • (Boolean)


24
25
26
# File 'app/models/user_field_type.rb', line 24

def acceptable_validations?
  valid_types? && valid_options?
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, options = {})
  json = {}
  json[mapping_field_name] = field_item.data['user']
  json
end

#mappingObject



34
35
36
# File 'app/models/user_field_type.rb', line 34

def mapping
  {name: mapping_field_name, type: :string, analyzer: :snowball}
end