For now, I've copied the code into the Customer model and required the imagemagick_wrapper in the model to get this to work. It works fine but is there no cleaner way?
On Sep 14, 1:20 pm, Ram <yourstruly.vi...@gmail.com> wrote: > Hi, > > I am using matisimitsu's barcode-generator for barcodes in PDFs with > Prawn and Prawnto.http://github.com/matsimitsu/barcode-generator/tree/master. > > I want to use the barcode method in a model where i generate the PDF > as a mail attachment, so that I can do this > > def with_attachment(pdfFile, customer) > subject "Voucher" > recipients customer.email > from "<x...@yyy.com>" > > part :content_type => "text/html", > :body => render_message("with_attachment", :customer => > customer) > > attachment :content_disposition => "attachment", > :body => pdfFile, > :content_type => "application/pdf", > :filename => 'voucher.pdf' > end > > Mailer.deliver_with_attachment(customer.generate_pdf_voucher, > customer) > > Where generate_pdf_voucher is a method in the Customer model and > renders a PDF Document. > > But right now, im getting the following error > > NoMethodError: undefined method `barcode' for #<Customer:0x23fcf94> > > How can I get around this problem? barcode_generator extends > ActionView to add the barcode method. --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---