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

[ci skip] Update guide sources for mailer view caching feature #23857

Merged
merged 5 commits into from
Feb 24, 2016
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions guides/source/5_0_release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ Please refer to the [Changelog][action-mailer] for detailed changes.
* Template lookup now respects default locale and I18n fallbacks.
([commit](https://github.com/rails/rails/commit/ecb1981b))

* Template can use fragment cache like Action View template.
([Pull Request](https://github.com/rails/rails/pull/22825))

* Added `_mailer` suffix to mailers created via generator, following the same
naming convention used in controllers and jobs.
([Pull Request](https://github.com/rails/rails/pull/18074))
Expand All @@ -327,6 +330,9 @@ Please refer to the [Changelog][action-mailer] for detailed changes.
the mailer queue name.
([Pull Request](https://github.com/rails/rails/pull/18587))

* Added `config.action_mailer.perform_caching` configuration to determine whether your templates should perform caching or not.
([Pull Request](https://github.com/rails/rails/pull/22825))


Active Record
-------------
Expand Down
16 changes: 16 additions & 0 deletions guides/source/action_mailer_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion guides/source/action_view_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ This would add something like "Process data files (0.34523)" to the log, which y

#### cache

A method for caching fragments of a view rather than an entire action or page. This technique is useful for caching pieces like menus, lists of news topics, static HTML fragments, and so on. This method takes a block that contains the content you wish to cache. See `ActionController::Caching::Fragments` for more information.
A method for caching fragments of a view rather than an entire action or page. This technique is useful for caching pieces like menus, lists of news topics, static HTML fragments, and so on. This method takes a block that contains the content you wish to cache. See `AbstractController::Caching::Fragments` for more information.

```erb
<% cache do %>
Expand Down
3 changes: 3 additions & 0 deletions guides/source/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ There are a number of settings available on `config.action_mailer`:
* `config.action_mailer.deliver_later_queue_name` specifies the queue name for
mailers. By default this is `mailers`.

* `config.action_mailer.perform_caching` specifies whether the mailer templates should perform fragment caching or not. By default this is false in all environments.


### Configuring Active Support

There are a few configuration options available in Active Support:
Expand Down