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}<br />" +
"#{@order.address.address_1}<br />" +
(@order.address.address_2.blank? ? '' : "#{@order.address.address_2}<br />") +
"#{@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