Class: Engine2::UploadFileStoreAction
- Defined in:
- lib/engine2/action/infra.rb
Instance Attribute Summary
Attributes inherited from Action
#assets, #invokable, #meta, #node, #static
Instance Method Summary collapse
Methods inherited from Action
action_type, #action_type, #arguments, #check_anonymous_action_class, #check_static_action, #define_invoke, #define_method, #dynamic?, #execute, #freeze_action, #http_method, http_method, inherit, inherited, #initialize, #invoke!, #join_keys, #lookup, #merge, #node_defined, #post_process, #post_run, #pre_run, #repeat, #request, #request_action_proc_params, #split_keys
Constructor Details
This class inherits a constructor from Engine2::Action
Instance Method Details
#invoke(handler) ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/engine2/action/infra.rb', line 109 def invoke handler file = handler.params[:file] temp = file[:tempfile] temp.close rackname = File.basename(temp.path) info = node.parent.*.model.type_info[node.parent.*.field] FileUtils.cp(temp.path, "#{info[:store][:upload]}/#{rackname}") # File.rename(temp.path, "#{info[:store][:upload]}/#{rackname}") FileUtils.rm(temp.path) {rackname: rackname} end |