Class: FileAttachmentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- FileAttachmentsController
- Defined in:
- app/controllers/file_attachments_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/file_attachments_controller.rb', line 51 def create if @file_attachment.save flash[:notice] = t(:file_attachment_created_successfully) redirect_to @referrer_path else flash.now[:error] = t(:file_attachment_created_unsuccessfully) render :new end end |
#mark_as_invalid ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/file_attachments_controller.rb', line 41 def mark_as_invalid @file_attachment.not_valid = true if @file_attachment.save flash[:notice] = t(:marked_attachment_as_invalid) else flash[:error] = t(:could_not_mark_attachment_as_invalid) end redirect_to @file_attachment.client || @file_attachment.ticket || @file_attachment.project end |
#new ⇒ Object
38 39 |
# File 'app/controllers/file_attachments_controller.rb', line 38 def new end |
#show ⇒ Object
34 35 36 |
# File 'app/controllers/file_attachments_controller.rb', line 34 def show send_file(@file_attachment..path, :disposition => 'attachment') end |