Class: ActionController::Responder

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

Instance Method Summary collapse

Instance Method Details

#to_pdfObject



157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/jasper-rails.rb', line 157

def to_pdf
  #jasper_file = "#{Rails.root.to_s}/app/views/#{controller.controller_path}/#{controller.action_name}.jasper"
  jasper_file =  (@options[:template] && "#{Rails.root.to_s}/app/views/#{controller.controller_path}/#{@options[:template]}") ||
      "#{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
  controller.send_data Jasper::Rails::render_pdf(jasper_file, resource, params, options), :type => Mime::PDF, :disposition => 'inline'
end