Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README to show how to init draper for all ActionMailer methods. #141

Merged
merged 1 commit into from Mar 13, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions Readme.markdown
Expand Up @@ -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
Expand Down