From f7ce370e602eadf44e3367d853baa8fde66bdb02 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 25 Feb 2016 00:36:41 +0800 Subject: Add caching guide in ActionMailer basics --- guides/source/action_mailer_basics.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'guides/source/action_mailer_basics.md') diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md index 91ea4efb55..558c16f5b0 100644 --- a/guides/source/action_mailer_basics.md +++ b/guides/source/action_mailer_basics.md @@ -407,6 +407,22 @@ use the rendered text for the text part. The render command is the same one used inside of Action Controller, so you can use all the same options, such as `:text`, `:inline` etc. +#### Caching mailer view + +You can do cache in mailer views like in application views using `cache` method. + +``` +<% cache do %> + <%= @company.name %> +<% end %> +``` + +And in order to use this feature, you need to configure your application with this: + +``` + config.action_mailer.perform_caching = true +``` + ### Action Mailer Layouts Just like controller views, you can also have mailer layouts. The layout name -- cgit v1.2.3