I am trying to setup sending confirmation emails after creating a new instance of Project. In my Project Model, I have an after_create callback that calls the method send_confirmation. This is working fine -- the method is called, but I haven't figured out how to pass along the current instance object to the Mailer class I've created.
I had assumed that instance variables were accessible from within the Project Model, even if created inside of the Project Controller. The code below results in error "nil.name undefined". So how do I get the mailer to know of the current instance object in order to send an email using its attributes.
Probably doing something stupid. Thanks in advance.
Project Model:
after_create :send_confirmation
def send_confirmation Mailer.deliver_confirm(@project) end
Mailer Class:
def confirm(project) ... subject project.name ... end