Module: GBDev::Utils::ControllerMethods

Defined in:
lib/pdf_filler/util_methods.rb

Overview

Include these controller methods to prompt the user to download the PDF.

  • include GBDev::Utils::ControllerMethods

Instance Method Summary collapse

Instance Method Details

#display_pdf(buffer, filename) ⇒ Object

Used to display the PDF without saving it to disk.

  • buffer - A Page buffer or Book buffer.

  • filename - The filename to apply to the buffer when prompted to download.



28
29
30
31
32
# File 'lib/pdf_filler/util_methods.rb', line 28

def display_pdf(buffer, filename)
  send_data(buffer, {:type        => 'application/pdf',
                     :disposition => 'attachment',
                     :filename    => filename} )
end

#rescue_action_in_public(exception) ⇒ Object

From here: railspdfplugin.rubyforge.org/wiki/wiki.pl Suggested code so errors will always show in browser



37
38
39
40
# File 'lib/pdf_filler/util_methods.rb', line 37

def rescue_action_in_public(exception) # :nodoc:
  headers.delete("Content-Disposition")
  super
end

#rescue_action_locally(exception) ⇒ Object

:nodoc:



42
43
44
45
# File 'lib/pdf_filler/util_methods.rb', line 42

def rescue_action_locally(exception) # :nodoc:
  headers.delete("Content-Disposition")
  super
end