Using ActionMailer on a controller method

The problem I am having, is when I try to create a new ticket, I get
the error:

NoMethodError (undefined method `customer' for nil:NilClass):
app/models/ticket_mailer.rb:7:in `newticket'
app/controllers/tickets_controller.rb:84:in `create'

Which I know simply put is telling me the customer doesn't exist,
because customer_id would be nil, so there is no association. But
there is.

No, it's telling you that the "ticket" variable (at line 7 of
ticket_mailer.rb) is nil, and NilClass objects don't have a "customer"

class TicketMailer < ActionMailer::Base
def newticket(ticket)
ticket = @ticket
subject 'A new ticket has been created for you'
from ''

I'd assume the problem is caused by the assignment in the first line
of the method; I'd guess it's meant to read:
  @ticket = ticket
..because as it is, it doesn't make much sense to pass in a ticket
parameter and then immediately overwrite it with an instance variable.

Do you have "map_resources :tickets" in your routes.rb file?

So when we get to line 5 of app/views/ticket_mailer/newticket.erb,
you're passing the @ticket variable to the link_to helper... so what's
the value of @ticket at this stage? Is it actually a "Ticket" object,
or is it Nil?