Help with pdf writer and show controller

This is my show controller for repair_tickets:

def show
@repair_ticket = RepairTicket.find(params[:id])


respond_to do |format|
  format.html # show.html.erb
  format.xml  { render :xml => @repair_ticket }

  format.pdf do
    send_data RepairTicketDrawer.draw(@repair_ticket), :filename =>

‘repair_tickets/’, :type => ‘application/pdf’,
:disposition => ‘inline’

and this is my public class:

class RepairTicketDrawer
def self.draw(repair_ticket)
pdf =
pdf.text “Test”
pdf.text (repair_ticket.client_id)

This line gices me problems:
pdf.text (repair_ticket.client_id)

I get:
NoMethodError in Repair ticketsController#show
undefined method `each’ for 1:Fixnum

try pdf.text (repair_ticket.client_id.to_s)

i do this in my classes when generating an report. after that, i did
not get any more errors :wink:
(I look up attributes in an more generic way, so that i can do
report_and_send(@repair_ticket, options) and have only the desired
attributes rendered in an template. there i alwys do the to_s, since
once i got an error that sounds like yours with numeric values.

On Jan 12, 1:47 pm, John S. [email protected]