Created
August 29, 2012 13:24
-
-
Save hidakatsuya/3512427 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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