Class: Terrazzo::Field::String
- Defined in:
- lib/terrazzo/field/string.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
#attribute, #data, #options, #page, #resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
associative?, eager_load?, #field_type, field_type, #form_input_attributes, #initialize, permitted_attribute, #required?, searchable?, #serializable_options, sortable?, transform_param, with_options
Constructor Details
This class inherits a constructor from Terrazzo::Field::Base
Class Method Details
.default_options ⇒ Object
17 18 19 |
# File 'lib/terrazzo/field/string.rb', line 17 def { truncate: 50 } end |
Instance Method Details
#serialize_value(mode) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/terrazzo/field/string.rb', line 4 def serialize_value(mode) return data.to_s if data.nil? case mode when :index truncate_length = .fetch(:truncate, 50) data.to_s.truncate(truncate_length) else data.to_s end end |