Hi,
In my controller:
Emailer.deliver_site_update(user)
In my action mailer class:
class Emailer < ActionMailer::Base
def self.deliver_site_update(user, site_update) @recipients = "#{user.email}" @content_type = "text/html" @sent_on = Time.now @from = 'Test <test@email.com>' @subject = "Test site update news" body :user => user end
end
A couple of things:
if i dont put self before the method deliver_site_update i get a method missing error for deliver_site_update for class Emailer, i know why this is as im calling it straight from the class name and not an instance variable but strangely ive never done this in any of my other apps before and its worked ok.
I keep getting undefined method `body' for Emailer:Class - (NoMethodError)
Ive also tried @body[:user => user] and i get a nil. error
ive also tried other combinations ive seen on the net and from my previous working applications. I cant spot what the problem is and its driving me nuts. Can anyone help?
Trace below
undefined method `body' for Emailer:Class - (NoMethodError) c:/ruby/lib/ruby/gems/1.8/gems/actionmailer-2.0.2/lib/action_mailer/base.rb:354:in `method_missing'