ActionMailer & application_helper.rb

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?

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.

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.