Ari
2010-Nov-19 15:24 UTC
how to include view helpers in both action_controller and action_mailer templates (rails 3)
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: 1) 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? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.