Class: AssetFieldType
- Inherits:
-
FieldType
- Object
- FieldType
- AssetFieldType
- Defined in:
- app/models/asset_field_type.rb
Constant Summary collapse
- VALIDATION_TYPES =
{ presence: :valid_presence_validation?, size: :valid_size_validation?, content_type: :valid_content_type_validation? }.freeze
Instance Attribute Summary collapse
-
#asset_content_type ⇒ Object
Returns the value of attribute asset_content_type.
-
#asset_file_name ⇒ Object
Returns the value of attribute asset_file_name.
-
#asset_file_size ⇒ Object
Returns the value of attribute asset_file_size.
-
#asset_updated_at ⇒ Object
Returns the value of attribute asset_updated_at.
-
#data ⇒ Object
Returns the value of attribute data.
-
#field_name ⇒ Object
Returns the value of attribute field_name.
-
#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
#asset_content_type ⇒ Object
Returns the value of attribute asset_content_type.
8 9 10 |
# File 'app/models/asset_field_type.rb', line 8 def asset_content_type @asset_content_type end |
#asset_file_name ⇒ Object
Returns the value of attribute asset_file_name.
8 9 10 |
# File 'app/models/asset_field_type.rb', line 8 def asset_file_name @asset_file_name end |
#asset_file_size ⇒ Object
Returns the value of attribute asset_file_size.
8 9 10 |
# File 'app/models/asset_field_type.rb', line 8 def asset_file_size @asset_file_size end |
#asset_updated_at ⇒ Object
Returns the value of attribute asset_updated_at.
8 9 10 |
# File 'app/models/asset_field_type.rb', line 8 def asset_updated_at @asset_updated_at end |
#data ⇒ Object
Returns the value of attribute data.
14 15 16 |
# File 'app/models/asset_field_type.rb', line 14 def data @data end |
#field_name ⇒ Object
Returns the value of attribute field_name.
8 9 10 |
# File 'app/models/asset_field_type.rb', line 8 def field_name @field_name end |
#validations ⇒ Object
Returns the value of attribute validations.
14 15 16 |
# File 'app/models/asset_field_type.rb', line 14 def validations @validations end |
Instance Method Details
#acceptable_validations? ⇒ Boolean
29 30 31 |
# File 'app/models/asset_field_type.rb', line 29 def acceptable_validations? valid_types? && end |
#field_item_as_indexed_json_for_field_type(field_item, options = {}) ⇒ Object
33 34 35 36 37 |
# File 'app/models/asset_field_type.rb', line 33 def field_item_as_indexed_json_for_field_type(field_item, = {}) json = {} json[mapping_field_name] = asset_file_name json end |
#mapping ⇒ Object
39 40 41 |
# File 'app/models/asset_field_type.rb', line 39 def mapping {name: mapping_field_name, type: :string, analyzer: :keyword} end |