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
8 9 10 11 12 13 14 |
# File 'app/controllers/files_controller.rb', line 8 def create = { :key => params[:id], :body => File.open(File. "nouns.txt") } container.create end |
#destroy ⇒ Object
20 21 22 |
# File 'app/controllers/files_controller.rb', line 20 def destroy file.destroy end |
#download ⇒ Object
24 25 26 27 28 29 30 |
# File 'app/controllers/files_controller.rb', line 24 def download File.open((File. "download-" + params[:id]), 'w') do | f | container.get(params[:id]) do | data, remaining, content_length | f.syswrite data end end end |
#index ⇒ Object
4 5 6 |
# File 'app/controllers/files_controller.rb', line 4 def index container.all end |
#show ⇒ Object
16 17 18 |
# File 'app/controllers/files_controller.rb', line 16 def show file end |