Hi, I'm a little stuck on this. what I'm going to work out is that I have a file called ticket_pdf.rb in the lib / directory, which I plan to generate some PDF invoice files for my application. I want to call a function of this class to create PDF files from my actions with the controller.
ticket_pdf.rb is as follows
class TicketPDF def generate_pdf (purchase) puts "Ticket ID = #{purchase.ID}" end end
In the action of the controller, I am doing this.
class Customer::MyController < ApplicationController require 'ticket_pdf' def show ticket = TicketPDF.new end end
when I try to create such an object, it gives me a 500 error like this.
uninitialized constant Customer::MyController::TicketPDF
what am i doing wrong here?
source share