Nevermind, I figured it out. Definitely a "duh" moment. From within
the class, using self points to the current instance.
Thanks,
Eric
On Jan 31, 12:17 pm, ericindc
<ericmilf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---