Helpers in mailing templates

i’m having a problem using custom helpers in mailing templates.
because action mailer never uses a controller it doesn’t inherit the
helper module and i sadly can also not use the helpers from the
controller than calls the deliver method. this seems like a
shortcoming, not a feature.

anybody come up with a work around. i know you can use rails default
helpers like truncate, so it must be possible to stuff the custom ones
somewhere.

thanks for any help.
lawrence

On Mon, 2007-06-04 at 11:38 -0700, plewizard wrote:

i’m having a problem using custom helpers in mailing templates.
because action mailer never uses a controller it doesn’t inherit the
helper module and i sadly can also not use the helpers from the
controller than calls the deliver method. this seems like a
shortcoming, not a feature.

anybody come up with a work around. i know you can use rails default
helpers like truncate, so it must be possible to stuff the custom ones
somewhere.

Try adding:

include ActionView::Helpers::TextHelper
include ActionView::Helpers::TagHelper
include ApplicationHelper

to the class, or atleast the ApplicationHelper one. I haven’t tried it,
but it may work.


Matthew B. :: 607 227 0871
Resume & Portfolio @ http://madhatted.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs