# ActionMailer calling shared methods

**URL:** <https://www.ruby-forum.com/t/actionmailer-calling-shared-methods/225991>\
**Category:** Rails\
**Created:** [January 29, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/actionmailer-calling-shared-methods/225991 "2008-01-29T16:39:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkoebbe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ec9cab/32.png) [@pkoebbe](https://www.ruby-forum.com/u/pkoebbe)\
**Post date:** [January 29, 2008, 4:39pm UTC](https://www.ruby-forum.com/t/actionmailer-calling-shared-methods/225991/1 "2008-01-29T16:39:03Z")

</div>

I’m trying to use a shared method from an ActionMailer template. The  
method was originally in ApplicationHelper, but I’ve also tried it in  
the base controller (application.rb), with and without  
helper\_method. In all cases, I get an error

undefined method `wgg\_replace\_crlf’ for #ActionView::Base:0x324b230

Here is the relevant block of code from the email template

\<%  
address =  
if @order.address.is\_foreign  
wgg\_replace\_crlf(@order.address.foreign\_address)  
else  
“#{@order.address.addressee}  
” +  
“#{@order.address.address\_1}  
” +  
(@order.address.address\_2.blank? ? ‘’ : “#  
{@order.address.address\_2}  
”) +  
“#{@order.address.city}, #{@order.address.state} #  
{@order.address.zip\_code}” +  
(@order.address.plus\_four.blank? ? ‘’ : “-#  
{@order.address.plus\_four}”)  
end  
%\>

I have also tried prefacing the method call with  
ApplicationHelper::, but that didn’t work either. How does one use  
shared methods in email templates?

Peace,  
Phillip
