Class: Terrazzo::Field::Asset
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?, default_options, #field_type, field_type, #form_input_attributes, #initialize, permitted_attribute, #required?, #serializable_options, transform_param, with_options
Constructor Details
This class inherits a constructor from Terrazzo::Field::Base
Class Method Details
.eager_load? ⇒ Boolean
28 29 30 |
# File 'lib/terrazzo/field/asset.rb', line 28 def eager_load? true end |
.searchable? ⇒ Boolean
20 21 22 |
# File 'lib/terrazzo/field/asset.rb', line 20 def searchable? false end |
Instance Method Details
#serialize_value(mode) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/terrazzo/field/asset.rb', line 4 def serialize_value(mode) return nil if data.nil? || !data.attached? case mode when :index data.filename.to_s when :show { filename: data.filename.to_s, byteSize: data.byte_size, contentType: data.content_type } when :form { filename: data.filename.to_s, signedId: data.signed_id } else data.filename.to_s end end |