Variable Access in Prawn

Hi, i am working on a rails app, and i generate the page using Prawn for
PDF, but while i use this command:

<%=@carbon_calculate.comments%> on the show.html.pdf, it generates just
the only column available for display in the database, but

in the show.pdf, uisng the same command generates other columns in the
table which are not meant to be accessable, e.g date created, time e.t.c

please what can i do

Hi, i am working on a rails app, and i generate the page using Prawn for
PDF, but while i use this command:

<%=@carbon_calculate.comments%> on the show.html.pdf, it generates just
the only column available for display in the database, but

in the show.pdf, uisng the same command generates other columns in the
table which are not meant to be accessable, e.g date created, time e.t.c

please what can i do

I don't understand what you mean by " the only column available for
display in the database".
What is @carbon_calculate.comments? Is it a field in the database or
an association to another table?

Colin

First install gem prawn

Write the following code in the controller where you want to see the record in pdf

take one instance variable ex:

@xyz=(write query here)

def report

prawnto :prawn => {

:page_size => ‘A4’,

:left_margin => 10,

:right_margin => 10,

:top_margin => 10,

:bottom_margin => 30},

:filename => “#{@advance_payment.advance_date.strftime(”%d-%m-%y")}.pdf"

render :layout => false

end

in the report.pdf.prawn page

use the instance variable to print the record in pdf file like

pdf.draw_text "
#{@xyz.firstname} ", :at => [150, line_no-7*difference] , :size =>10

firstname is the field in the table