title: calling classes in /lib from controller actions
body: <p>hi i am a bit stuck with this. what i am going to work out is that i have a file called ticket_pdf.rb in lib/ directory which i am planning to generate some invoice PDFs for my app. I want to call a function of this class to generate  the PDFs from my controller actions. </p>
  
  <p>the ticket_pdf.rb looks like this </p>
  
  <pre><code>class TicketPDF
    def generate_pdf (purchase)
      puts "Ticket ID = #{purchase.ID}"
    end
  end
  </code></pre>
  
  <p>in a controller I action i do this.</p>
  
  <pre><code>class Customer::MyController &lt; ApplicationController
    require 'ticket_pdf'
  
    def show
      ticket = TicketPDF.new
    end
  end
  </code></pre>
  
  <p>when i try to create an object like this it give me a 500 error like this one.</p>
  
  <pre><code>uninitialized constant Customer::MyController::TicketPDF
  </code></pre>
  
  <p>what i am doing wrong here ?</p>