Class: Engine2::DownloadBlobStoreMeta

Inherits:
Meta show all
Includes:
BlobSupportMeta
Defined in:
lib/engine2/meta/infra_meta.rb

Instance Attribute Summary

Attributes inherited from Meta

#action, #assets, #invokable, #static

Instance Method Summary collapse

Methods included from BlobSupportMeta

#serve_blob

Methods inherited from Meta

#action_defined, #check_static_meta, #dynamic?, #freeze_meta, #get, http_method, #http_method, inherited, #initialize, #invoke!, #lookup, #merge, #meta_type, meta_type, #post_process, #post_run, #pre_run, #request, #request_meta_proc_params, #split_keys

Constructor Details

This class inherits a constructor from Engine2::Meta

Instance Method Details

#invoke(handler) ⇒ Object



157
158
159
160
161
162
163
164
# File 'lib/engine2/meta/infra_meta.rb', line 157

def invoke handler
    model = action.parent.*.model
    inf = model.type_info[action.parent.*.field]
    handler.permit id = handler.params[:id]

    entry = model.naked.select(inf[:bytes_field], inf[:name_field], inf[:mime_field]).where(model.primary_keys_hash(split_keys(id))).first
    serve_blob(handler, entry, inf)
end