diff options
Diffstat (limited to 'guides')
-rw-r--r-- | guides/CHANGELOG.md | 5 | ||||
-rw-r--r-- | guides/source/5_0_release_notes.md | 6 | ||||
-rw-r--r-- | guides/source/action_mailer_basics.md | 16 | ||||
-rw-r--r-- | guides/source/action_view_overview.md | 2 | ||||
-rw-r--r-- | guides/source/api_app.md | 17 | ||||
-rw-r--r-- | guides/source/caching_with_rails.md | 8 | ||||
-rw-r--r-- | guides/source/configuring.md | 14 |
7 files changed, 67 insertions, 1 deletions
diff --git a/guides/CHANGELOG.md b/guides/CHANGELOG.md index d58016053b..d35d0f1976 100644 --- a/guides/CHANGELOG.md +++ b/guides/CHANGELOG.md @@ -1,3 +1,8 @@ +## Rails 5.0.0.beta3 (February 24, 2016) ## + +* No changes. + + ## Rails 5.0.0.beta2 (February 01, 2016) ## * No changes. diff --git a/guides/source/5_0_release_notes.md b/guides/source/5_0_release_notes.md index f5abbd0cd4..91bca16356 100644 --- a/guides/source/5_0_release_notes.md +++ b/guides/source/5_0_release_notes.md @@ -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)) @@ -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 ------------- 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 diff --git a/guides/source/action_view_overview.md b/guides/source/action_view_overview.md index 5e6eae1071..29e0943741 100644 --- a/guides/source/action_view_overview.md +++ b/guides/source/action_view_overview.md @@ -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 %> diff --git a/guides/source/api_app.md b/guides/source/api_app.md index 0598b9c7fa..8dba914923 100644 --- a/guides/source/api_app.md +++ b/guides/source/api_app.md @@ -166,6 +166,23 @@ class definition: config.api_only = true ``` +In `config/environments/development.rb`, set `config.debug_exception_response_format` +to configure the format used in responses when errors occur in development mode. + +To render an HTML page with debugging information, use the value `:default`. + +```ruby +config.debug_exception_response_format = :default +``` + +To render debugging information preserving the response format, use the value `:api`. + +```ruby +config.debug_exception_response_format = :api +``` + +By default, `config.debug_exception_response_format` is set to `:api`. + Finally, inside `app/controllers/application_controller.rb`, instead of: ```ruby diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md index 3a1a1ccfe6..f26019c72e 100644 --- a/guides/source/caching_with_rails.md +++ b/guides/source/caching_with_rails.md @@ -521,6 +521,14 @@ class ProductsController < ApplicationController end ``` +### A note on weak ETags + +Etags generated by Rails are weak by default. Weak etags allow symantically equivalent responses to have the same etags, even if their bodies do not match exactly. This is useful when we don't want the page to be regenerated for minor changes in response body. If you absolutely need to generate a strong etag, it can be assigned to the header directly. + +```ruby + response.add_header "ETag", Digest::MD5.hexdigest(response.body) +``` + References ---------- diff --git a/guides/source/configuring.md b/guides/source/configuring.md index a5fb396f15..3f522386d3 100644 --- a/guides/source/configuring.md +++ b/guides/source/configuring.md @@ -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: @@ -610,6 +613,17 @@ There are a few configuration options available in Active Support: * `config.active_job.logger` accepts a logger conforming to the interface of Log4r or the default Ruby Logger class, which is then used to log information from Active Job. You can retrieve this logger by calling `logger` on either an Active Job class or an Active Job instance. Set to `nil` to disable logging. +### Configuring Action Cable + +* `config.action_cable.url` accepts a string for the URL for where + you are hosting your Action Cable server. You would use this option +if you are running Action Cable servers that are separated from your +main application. +* `config.action_cable.mount_path` accepts a string for where to mount Action + Cable, as apart of the main server process. Defaults to `/cable`. +You can set this as nil to not mount Action Cable as apart of your +normal Rails server. + ### Configuring a Database Just about every Rails application will interact with a database. You can connect to the database by setting an environment variable `ENV['DATABASE_URL']` or by using a configuration file called `config/database.yml`. |