# Actionmailer weirdness

**URL:** <https://www.ruby-forum.com/t/actionmailer-weirdness/144179>\
**Category:** Rails\
**Created:** [July 26, 2008, 8:01am UTC](https://www.ruby-forum.com/t/actionmailer-weirdness/144179 "2008-07-26T08:01:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [July 26, 2008, 8:01am UTC](https://www.ruby-forum.com/t/actionmailer-weirdness/144179/1 "2008-07-26T08:01:00Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)’  
@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’

---

<div class="post-metadata">

**Author:** ![johnnybutler7](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/8491ac/32.png) [@johnnybutler7](https://www.ruby-forum.com/u/johnnybutler7)\
**Post date:** [July 26, 2008, 8:40am UTC](https://www.ruby-forum.com/t/actionmailer-weirdness/144179/2 "2008-07-26T08:40:38Z")

</div>

John B. wrote:

> Hi,
> 
> In my controller:
> 
> Emailer.deliver\_site\_update(user)
> 
> In my action mailer class:

I know, its the deliver before the method! Dumb \*\*\*
