Hi Sergio/Benjamin 

With the help of the Action Link API, I can now show the to_pdf in the AS 
Grid,

Followed the Railcast # 158 on PDF with Prawn

Click the to_pdf link on AS and get the following error message

NoMethodError in Payslips#to_pdf

Showing *C:/RubymineProjects/pms4mysql/app/views/payslips/to_pdf.pdf.prawn* 
where 
line *#5* raised:

undefined method `eno' for nil:NilClass

Extracted source (around line *#5*):

3
4
5
6
7
8
              

pdf.move_down(30)
payslips=[payslips.eno, payslips.ename, payslips.dept, payslips.netpay]
#items = @order.cart.line_items.map do |item|
#  [
#    item.product.name,

*to_pdf.pdf.prawn (my table is paylips with fields eno,ename,netpay)*
================

#pdf.text "Order ##{@order.id}", :size => 30, :style => :bold
pdf.text "Payslip ##{@payslip.eno}", :size => 30, :style => :bold
pdf.move_down(30)

payslips=[payslips.eno, payslips.ename, payslips.dept, payslips.netpay]
#items = @order.cart.line_items.map do |item|
#  [
#    item.product.name,
#    item.quantity,
#    number_to_currency(item.unit_price),
#    number_to_currency(item.full_price)
#  ]
#end

pdf.table items, :border_style => :grid,
  :row_colors => ["FFFFFF","DDDDDD"],
  :h

eaders => ["Employee #", "Name", "Dept", "Net Pay"],
  :align => { 0 => :left, 1 => :right, 2 => :right, 3 => :right }

pdf.move_down(10)


What am I doing wrong ?

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails Gem" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/activescaffold.
For more options, visit https://groups.google.com/d/optout.

Reply via email to