From 2dbc669f9df086c80759c963975f045d439dacbc Mon Sep 17 00:00:00 2001 From: Joe Van Dyk Date: Wed, 7 Mar 2012 13:59:32 -0800 Subject: [PATCH] Update README to show how to init draper for all ActionMailer methods. --- Readme.markdown | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Readme.markdown b/Readme.markdown index a32ceda..d382587 100644 --- a/Readme.markdown +++ b/Readme.markdown @@ -235,15 +235,11 @@ Use the new methods in your views like any other model method (ex: `@article.pub ### Using in Mailers To use decorators in mailers that use helpers, you have to call `set_current_view_context` in your -mailer method: +ActionMailer class. ```ruby class ArticleMailer < ActionMailer::Base - def new_article(article) - set_current_view_context - @article_decorator = ArticleDecorator.decorate(article) - mail(:to => 'come@me.bro', :subject => "New Article: #{@article_decorator.title}") - end + defaults 'init-draper' => Proc.new { set_current_view_context } end ``` ### Integration with RSpec