There’s some terse documentation that helpers can be shared between
action_controller and action_mailer, but I have yet to find an example
of how this is done. Right now, I’m trying to use a “markdown” method
in the view templates for both. I have put the method in the
application helper (app/helpers/application_helper.rb). It works in
the view templates called from action_controller and descendents, but
not action_mailer. The action mailer templates return something like
this (from an rspec test):
Failures:
- Request should have a send_reject_notice! method which sends a
rejection notice and saves
Failure/Error: @request.send_reject_notice!
undefined method `markdown’ for #<#Class:0x000000060441f0:
0x00000006041d88>./app/views/request_mailer/reject_notice.html.erb:9:in
_app_views_request_mailer_reject_notice_html_erb__435172659881060762_50505700__363986106511591665' # ./app/mailers/request_mailer.rb:8:in
reject_notice’
# ./app/models/request.rb:81:in send_reject_notice!' # ./spec/models/request_spec.rb:186:in
block (2 levels) in <top
(required)>’
Can someone explain what’s going on?