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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
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 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
On 17 July 2012 03:48, deee el <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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.cI 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit https://groups.google.com/groups/opt_out.
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
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.