Add possibility to add an attachment to an invoice #345
This commit is contained in:
parent
8d5467ab7c
commit
749791bb7a
14 changed files with 75 additions and 1 deletions
|
|
@ -62,6 +62,13 @@ class Finance::InvoicesController < ApplicationController
|
|||
redirect_to finance_invoices_url
|
||||
end
|
||||
|
||||
def attachment
|
||||
@invoice = Invoice.find(params[:invoice_id])
|
||||
type = MIME::Types[@invoice.attachment_mime].first
|
||||
filename = "invoice_#{@invoice.id}_attachment.#{type.preferred_extension}"
|
||||
send_data(@invoice.attachment_data, :filename => filename, :type => type)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_invoice
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue