Skip to content

Instantly share code, notes, and snippets.

@hidakatsuya
Created August 29, 2012 13:24
Show Gist options
  • Save hidakatsuya/3512427 to your computer and use it in GitHub Desktop.
Save hidakatsuya/3512427 to your computer and use it in GitHub Desktop.
# app/controller/tasks_controller.rb
class TasksController < ApplicationController
def index
@tasks = Task.all
respond_to do |format|
format.html
format.pdf {
report = ThinReports::Report.new :layout => '/path/to/tasks.tlf'
@tasks.each do |task|
report.list.add_row :name => task.name
end
send_data report.generate, :filename => 'tasks.pdf',
:type => 'application/pdf'
}
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment