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-zuv13RyHHZkAvxtiuMwx3w@public.gmane.org>''
@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''
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---