# ActionMailer & application\_helper.rb

**URL:** <https://www.ruby-forum.com/t/actionmailer-application-helper-rb/77380>\
**Category:** Rails\
**Created:** [November 27, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/actionmailer-application-helper-rb/77380 "2006-11-27T14:06:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [November 27, 2006, 2:06pm UTC](https://www.ruby-forum.com/t/actionmailer-application-helper-rb/77380/1 "2006-11-27T14:06:02Z")

</div>

Hi,

I’m trying to send some emails with the same formatting as my pages & I  
can’t seem to access my display routines in application\_helper.rb. I’m  
trying a hack to bypass this.

At the top of my ActionMailer notifier script I’ve included  
application\_helper.rb - my understanding is that this should arrive as a  
module and should be able to be used accordingly.

\<% require File.dirname( **FILE** ) +  
‘/…/…/helpers/application\_helper.rb’ %\>  
\<% display\_money = ApplicationHelper.display\_money -%\>

However I get a compile error:

undefined method `display\_money’ for ApplicationHelper:Module

The ‘display\_money’ routine does exist in application\_helper.rb & is  
working happily when rendering my pages.

Any ideas on how I can overcome this?

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [November 28, 2006, 3:17pm UTC](https://www.ruby-forum.com/t/actionmailer-application-helper-rb/77380/2 "2006-11-28T15:17:51Z")

</div>

Matt S. wrote:

> Hi,
> 
> I’m trying to send some emails with the same formatting as my pages & I  
> can’t seem to access my display routines in application\_helper.rb. I’m  
> trying a hack to bypass this.

I think you can make the application helper available by adding:

helper :application

to the mailer model.

---

<div class="post-metadata">

**Author:** ![matthew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ed655f/32.png) [@matthew](https://www.ruby-forum.com/u/matthew)\
**Post date:** [November 28, 2006, 4:32pm UTC](https://www.ruby-forum.com/t/actionmailer-application-helper-rb/77380/3 "2006-11-28T16:32:01Z")

</div>

Indeed you can - works great now.

Many thanks.

Rob N. wrote:

> Matt S. wrote:
> 
> > Hi,
> > 
> > I’m trying to send some emails with the same formatting as my pages & I  
> > can’t seem to access my display routines in application\_helper.rb. I’m  
> > trying a hack to bypass this.
> 
> I think you can make the application helper available by adding:
> 
> helper :application
> 
> to the mailer model.
