Class: Engine2::DownloadFileStoreMeta
- Defined in:
- lib/engine2/meta/infra_meta.rb
Instance Attribute Summary
Attributes inherited from Meta
#action, #assets, #invokable, #static
Instance Method Summary collapse
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
113 114 115 116 117 118 119 120 121 |
# File 'lib/engine2/meta/infra_meta.rb', line 113 def invoke handler handler.permit id = handler.params[:id] entry = E2Files.db[:files].select(:name, :mime)[id: id] handler.permit entry handler. entry[:name] handler.content_type (entry[:mime].to_s.empty? ? "application/octet-stream" : entry[:mime]) info = action.parent.*.model.type_info[action.parent.*.field] open("#{info[:store][:files]}/#{entry[:name]}_#{id}", 'rb'){|f|f.read} end |