Difficulty with body in ActionMailer

Taylor Strait <rails-mailing-list@andreas-s.net> said:

AWRDwRv2 is pretty vague on the @body part of setting up a mailer. Here is my problem:

>> p = Person.find(1) => #<Person:0x45c944c>

>> SiteMailer.request_admin_approval(p) NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.=         from site_mailer.rb:10:in `request_admin_approval'         from (irb):2

ln def self.request_admin_approval(person)       @subject = 'New User Notification' 10 @body["person"] = person

body = :person => person

That should do what you are looking for.

Taylor Strait <rails-mailing-list@andreas-s.net> said:

> body = :person => person > > That should do what you are looking for. >

Thanks, Mark. Where did that come from? There isn't anything like it in AWDwRv2.

http://api.rubyonrails.org has some nice examples on it. It currently seems to be down though.

Taylor Strait <rails-mailing-list@andreas-s.net> said:

This syntax doesn't work for me:

> body = :person => person

But this does:

body :person => person

Yup, oops. I meant to remove that =. I always go by whatever is on api.rubyonrails.org.