Module: RailsPdfRenderer::ActionControllerHelper

Defined in:
lib/rails/pdf/renderer/action_controller_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prepended(base) ⇒ Object



3
4
5
6
7
# File 'lib/rails/pdf/renderer/action_controller_helper.rb', line 3

def self.prepended(base)
  # Protect from trying to augment modules that appear
  # as the result of adding other gems.
  return if base != ActionController::Base
end

Instance Method Details

#render(*args) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/rails/pdf/renderer/action_controller_helper.rb', line 9

def render(*args)
  options = args.first
  if options.is_a?(Hash) && options.key?(:pdf)
    make_and_send_pdf(options.delete(:pdf), RailsPdfRenderer.configuration.default_options.merge(options))
  else
    super
  end
end

#render_to_string(*args) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/rails/pdf/renderer/action_controller_helper.rb', line 18

def render_to_string(*args)
  options = args.first
  if options.is_a?(Hash) && options.key?(:pdf)
    make_pdf(RailsPdfRenderer.configuration.default_options.merge(options))
  else
    super
  end
end