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) ⇒ Object

template : invoices/show.pdf instance_variables : => account - variables set in before filters



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

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

  if calling_object
    instance.prawnto :inline => true, :instance_variables_from => calling_object
  end
  
  return instance.render_to_string(:action => template, :template => false, :formats => [:pdf]).html_safe
end