Class: StringField
- Defined in:
- lib/yodel/models/core/fields/string_field.rb
Direct Known Subclasses
ColorField, EmailField, EnumField, FilteredStringField, PasswordField, TextField
Constant Summary
Constants inherited from Field
Instance Attribute Summary
Attributes inherited from Field
Instance Method Summary collapse
- #from_json(value, record) ⇒ Object
- #search_terms_set(record) ⇒ Object
- #untypecast(value, record) ⇒ Object
Methods inherited from Field
#default_input_type, #display?, field_from_type, from_options, #include_in_search_keywords?, #index?, #inherited?, #initialize, #method_missing, #numeric?, #required?, #searchable?, #strip_nil?, #to_json, #to_str, #typecast, #unique?, #validate
Constructor Details
This class inherits a constructor from Field
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Field
Instance Method Details
#from_json(value, record) ⇒ Object
10 11 12 |
# File 'lib/yodel/models/core/fields/string_field.rb', line 10 def from_json(value, record) value.to_s end |
#search_terms_set(record) ⇒ Object
2 3 4 |
# File 'lib/yodel/models/core/fields/string_field.rb', line 2 def search_terms_set(record) record.get(name).to_s.gsub(/\W+/, ' ').split end |
#untypecast(value, record) ⇒ Object
6 7 8 |
# File 'lib/yodel/models/core/fields/string_field.rb', line 6 def untypecast(value, record) value.nil? ? nil : value.to_s end |