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 ;)
(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 Smith
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> This is my show controller for repair_tickets:
>
> def show
> @repair_ticket = RepairTicket.find(params[:id])
>
> logger.debug(@rp_parts)
>
> 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/@repair_ticket.id.pdf'', :type =>
''application/pdf'',
> :disposition => ''inline''
> end
>
> and this is my public class:
>
> class RepairTicketDrawer
> def self.draw(repair_ticket)
> pdf = PDF::Writer.new
> pdf.text "Test"
> pdf.text (repair_ticket.client_id)
> pdf.render
> end
> end
>
> This line gices me problems:
> pdf.text (repair_ticket.client_id)
>
> I get:
> NoMethodError in Repair ticketsController#show
> undefined method `each'' for 1:Fixnum
> --
> Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---