i am trying to generate a pdf of all of the users in an application that
i have built. i am still pretty new to ruby and rails so i don’t know
the best way to go about it.
here is my controller code:
class ReportsController < ApplicationController
_pdf = PDF::Writer.new
table = PDF::SimpleTable.new
user_data = 
for user in User.find(:all)
user_data << user.attributes
table.data = user_data
send_data _pdf.render, :filename => 'hello.pdf', :type =>
i couldn’t figure out a better way to get the data out of the user model
than looping through and adding the attributes to an empty array. then i
used the array as my data for creating the pdf table.
currently i am getting an error saying that my columns are not defined,
yet using the console, i can see that my array is formatted just like
the ones in the examples.
any help would be greatly appreciated.