The problem I am having, is when I try to create a new ticket, I get
NoMethodError (undefined method `customer' for nil:NilClass):
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
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
ticket = @ticket
subject 'A new ticket has been created for you'
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.