Class: ImportableAttachments::AttachmentsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- ImportableAttachments::AttachmentsController
- Defined in:
- app/controllers/importable_attachments/attachments_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /attachments/:id.
-
#destroy ⇒ Object
DELETE /attachment/:id.
- #download ⇒ Object
-
#edit ⇒ Object
GET /attachments/:id/edit.
-
#index ⇒ Object
GET /attachments.
-
#new ⇒ Object
GET /attachments/new.
-
#show ⇒ Object
GET /attachments/:id.
-
#update ⇒ Object
PUT /attachments/:id.
Instance Method Details
#create ⇒ Object
POST /attachments/:id
54 55 56 57 58 59 60 61 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 54 def create @attachment = Attachment.new params[:attachment] if @attachment.save redirect_to , :notice => 'Successfully created attachment.' else render :new end end |
#destroy ⇒ Object
DELETE /attachment/:id
73 74 75 76 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 73 def destroy @attachment.destroy redirect_to , :notice => 'Successfully destroyed attachment.' end |
#download ⇒ Object
25 26 27 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 25 def download send_data(File.read(stream_path), ) end |
#edit ⇒ Object
GET /attachments/:id/edit
30 31 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 30 def edit end |
#index ⇒ Object
GET /attachments
13 14 15 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 13 def index respond_with @attachments end |
#new ⇒ Object
GET /attachments/new
18 19 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 18 def new end |
#show ⇒ Object
GET /attachments/:id
22 23 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 22 def show end |
#update ⇒ Object
PUT /attachments/:id
64 65 66 67 68 69 70 |
# File 'app/controllers/importable_attachments/attachments_controller.rb', line 64 def update if @attachment.update_attributes params[:attachment] redirect_to , :notice => 'Successfully updated attachment.' else render :edit end end |