Class: FilesController
- Inherits:
-
MVCLI::Controller
- Object
- MVCLI::Controller
- FilesController
- Defined in:
- app/controllers/files_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/files_controller.rb', line 9 def create template = Files::CreateForm argv = MVCLI::Argv.new command.argv form = template.new argv. form.validate! = { :key => params[:id], :body => form.file.to_s } container.create end |
#destroy ⇒ Object
26 27 28 |
# File 'app/controllers/files_controller.rb', line 26 def destroy file.destroy end |
#download ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/files_controller.rb', line 30 def download template = Files::DownloadForm argv = MVCLI::Argv.new command.argv form = template.new argv. form.validate! File.open(form.destination.to_s, 'w') do | f | container.get(params[:id]) do | data, remaining, content_length | f.syswrite data end end end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/files_controller.rb', line 5 def index container.all end |
#show ⇒ Object
22 23 24 |
# File 'app/controllers/files_controller.rb', line 22 def show file end |