Permalink
Browse files

clean up attachment/filename functionality

  • Loading branch information...
1 parent 503a786 commit 7000abdfaf826f2c2adbe0affd79b94d365f6b2b thorny_sun committed Jul 30, 2008
Showing with 4 additions and 5 deletions.
  1. +4 −5 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

0 comments on commit 7000abd

Please sign in to comment.