Module: Prawnto::ModelRenderer

Defined in:
lib/prawnto/model_renderer.rb

Defined Under Namespace

Classes: CustomController

Class Method Summary collapse

Class Method Details

.to_string(template, calling_object = nil, prawn_options = {}) ⇒ Object

template : invoices/show.pdf instance_variables : => account - variables set in before filters prawn_options : options to be used when creating the document



16
17
18
19
20
21
22
23
24
# File 'lib/prawnto/model_renderer.rb', line 16

def self.to_string(template, calling_object = nil, prawn_options = {})
  instance = CustomController.new

  if calling_object
    instance.prawnto :inline => true, :instance_variables_from => calling_object, :prawn => prawn_options
  end

  return instance.render_to_string(:action => template, :template => false, :formats => [:pdf]).html_safe
end