Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

clean up attachment/filename functionality

  • Loading branch information...
commit 7000abdfaf826f2c2adbe0affd79b94d365f6b2b 1 parent 503a786
thorny_sun authored
Showing with 4 additions and 5 deletions.
  1. +4 −5 lib/prawnto.rb
9 lib/prawnto.rb
View
@@ -53,12 +53,11 @@ def template_setup_source_container
# for some reason above line is not working on subsequent requests for different pdfs, but the following does-- i have no clue?
headers['Content-Type'] ||= 'application/pdf'
- inline = @prawn_document_options.delete(:inline) || true
- filename = @prawn_document_options.delete(:filename) || 'xxx.pdf'
- inline = inline ? 'inline' : 'attachment'
+ attachment = @prawn_document_options.delete(:attachment)
+ filename = @prawn_document_options.delete(:filename)
+ attachment = attachment ? 'attachment' : 'inline'
filename = filename ? "filename=#{filename}" : nil
- disposition = [inline,filename].compact.join(';')
- puts disposition
+ disposition = [attachment,filename].compact.join(';')
headers["Content-Disposition"] ||= disposition if disposition.length > 0
Please sign in to comment.
Something went wrong with that request. Please try again.