Class: ActionController::Responder

Inherits:
Object
  • Object
show all
Defined in:
lib/jasper-rails.rb

Instance Method Summary collapse

Instance Method Details

#to_pdfObject



144
145
146
147
148
149
150
151
152
153
# File 'lib/jasper-rails.rb', line 144

def to_pdf
  jasper_file = "#{Rails.root.to_s}/app/views/#{controller.controller_path}/#{controller.action_name}.jasper"

  params = {}
  controller.instance_variables.each do |v|
    params[v.to_s[1..-1]] = controller.instance_variable_get(v)
  end

  controller.send_data Jasper::Rails::render_pdf(jasper_file, resource, params, options), :type => Mime::PDF
end