module Shrine::Plugins::Column::AttacherMethods
Defined in:
shrine/plugins/column.crConstructors
-
.new(column_serializer = self.class.shrine_class.plugin_settings.column[:column_serializer], **options)
Allows overriding the default column serializer.
Instance Method Summary
-
#column_data : String?
Returns attacher data as a serialized string (JSON by default).
-
#column_serializer : Shrine::Plugins::Column::BaseSerializer.class
Column serializer object.
-
#load_column(data : String) : UploadedFile
Loads attachment from column data.
- #load_column(data : Nil) : Nil
Constructor Detail
def self.new(column_serializer = self.class.shrine_class.plugin_settings.column[:column_serializer], **options)
#
Allows overriding the default column serializer.
Instance Method Detail
def column_data : String?
#
Returns attacher data as a serialized string (JSON by default).
attacher.column_data #=> '{"id":"...","storage":"...","metadata":{...}}'
Column serializer object.
def load_column(data : String) : UploadedFile
#
Loads attachment from column data.
attacher.file #=> nil
attacher.load_column('{"id":"...","storage":"...","metadata":{...}}')
attacher.file #=> #<Shrine::UploadedFile>