aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/4_2_release_notes.md
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/4_2_release_notes.md')
-rw-r--r--guides/source/4_2_release_notes.md95
1 files changed, 57 insertions, 38 deletions
diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md
index c3803aa856..1e9107a8c6 100644
--- a/guides/source/4_2_release_notes.md
+++ b/guides/source/4_2_release_notes.md
@@ -4,7 +4,7 @@ Ruby on Rails 4.2 Release Notes
Highlights in Rails 4.2:
* Active Job
-* Asynchronous Mails
+* Asynchronous mails
* Adequate Record
* Web Console
* Foreign key support
@@ -41,13 +41,22 @@ Jobs written with the Active Job API run on any of the supported queues thanks
to their respective adapters. Active Job comes pre-configured with an inline
runner that executes jobs right away.
-Jobs often need to take Active Record objects as arguments, but we can't pass
-fully-marshaled Ruby objects through many queueing systems. Active Job passes
+Jobs often need to take Active Record objects as arguments. Active Job passes
object references as URIs (uniform resource identifiers) instead of marshaling
the object itself. The new [Global ID](https://github.com/rails/globalid)
library builds URIs and looks up the objects they reference. Passing Active
-Record objects as job arguments "just works:" Active Job passes a reference to
-the object, then looks up the object from its reference.
+Record objects as job arguments just works by using Global ID internally.
+
+For example, if `trashable` is an Active Record object, then this job runs
+just fine with no serialization involved:
+
+```ruby
+class TrashableCleanupJob < ActiveJob::Base
+ def perform(trashable, depth)
+ trashable.cleanup(depth)
+ end
+end
+```
See the [Active Job Basics](active_job_basics.html) guide for more
information.
@@ -70,9 +79,9 @@ on similar calls, skipping most of the query-generation work on subsequent
calls. For more details, please refer to [Aaron Patterson's blog
post](http://tenderlovemaking.com/2014/02/19/adequaterecord-pro-like-activerecord.html).
-Active Record will automatically take advantage of this feature on the
+Active Record will automatically take advantage of this feature on
supported operations without any user involvement or code changes. Here are
-some examples of the supported operations:
+some examples of supported operations:
```ruby
Post.find(1) # First call generates and cache the prepared statement
@@ -86,10 +95,10 @@ post.comments(true)
```
It's important to highlight that, as the examples above suggest, the prepared
-statements do not cache the values passed in the method calls, they rather
+statements do not cache the values passed in the method calls; rather, they
have placeholders for them.
-The caching is not used in the following scenarios:
+Caching is not used in the following scenarios:
- The model has a default scope
- The model uses single table inheritance
@@ -109,22 +118,15 @@ The caching is not used in the following scenarios:
### Web Console
-New applications generated from Rails 4.2 now come with the Web Console gem by
-default.
-
-Web Console is a set of debugging tools for your Rails application. It adds an
-interactive console on every error page and a `console` view and controller
-helper.
-
-The interactive console on the error pages lets you execute code where the
-exception originated. It's quite handy being able to introspect the state that
-led to the error.
+New applications generated with Rails 4.2 now come with the [Web
+Console](https://github.com/rails/web-console) gem by default. Web Console adds
+an interactive Ruby console on every error page and provides a `console` view
+and controller helpers.
-The `console` view helper launches an interactive console within the context of
-the view where it is invoked.
-
-The `console` controller helper spawns an interactive console within the
-context of the controller action it was invoked in.
+The interactive console on error pages lets you execute code in the context of
+the place where the exception originated. The `console` helper, if called
+anywhere in a view or controller, launches an interactive console with the final
+context, once rendering has completed.
### Foreign Key Support
@@ -164,11 +166,11 @@ The following changes may require immediate action upon upgrade.
### `render` with a String Argument
Previously, calling `render "foo/bar"` in a controller action was equivalent to
-`render file: "foo/bar"`. In Rails 4.2, this has been changed to mean `render template: "foo/bar"`
-instead. If you need to render a file, please change your code to use the
-explicit form (`render file: "foo/bar"`) instead.
+`render file: "foo/bar"`. In Rails 4.2, this has been changed to mean
+`render template: "foo/bar"` instead. If you need to render a file, please
+change your code to use the explicit form (`render file: "foo/bar"`) instead.
-### `respond_with` / class-level `respond_to`
+### `respond_with` / Class-Level `respond_to`
`respond_with` and the corresponding class-level `respond_to` have been moved
to the [responders](https://github.com/plataformatec/responders) gem. Add
@@ -207,8 +209,9 @@ end
Due to a [change in Rack](https://github.com/rack/rack/commit/28b014484a8ac0bbb388e7eaeeef159598ec64fc),
`rails server` now listens on `localhost` instead of `0.0.0.0` by default. This
-should have minimal impact on the standard development workflow as both http://127.0.0.1:3000
-and http://localhost:3000 will continue to work as before on your own machine.
+should have minimal impact on the standard development workflow as both
+http://127.0.0.1:3000 and http://localhost:3000 will continue to work as before
+on your own machine.
However, with this change you will no longer be able to access the Rails
server from a different machine, for example if your development environment
@@ -226,8 +229,8 @@ built upon [Loofah](https://github.com/flavorjones/loofah) and
[Nokogiri](https://github.com/sparklemotion/nokogiri). The new sanitizer is
more secure and its sanitization is more powerful and flexible.
-Due to the new algorithm, sanitized output changes for certain pathological
-inputs.
+Due to the new algorithm, the sanitized output may be different for certain
+pathological inputs.
If you have a particular need for the exact output of the old sanitizer, you
can add the [rails-deprecated_sanitizer](https://github.com/kaspth/rails-deprecated_sanitizer)
@@ -250,8 +253,13 @@ application is using any of these spellings, you will need to update them:
non-alphanumeric characters.
```
- a[href=/] => a[href="/"]
- a[href$=/] => a[href$="/"]
+ # before
+ a[href=/]
+ a[href$=/]
+
+ # now
+ a[href="/"]
+ a[href$="/"]
```
* DOMs built from HTML source containing invalid HTML with improperly
@@ -536,6 +544,17 @@ Please refer to the [Changelog][action-view] for detailed changes.
* Placeholder I18n follows the same convention as `label` I18n.
([Pull Request](https://github.com/rails/rails/pull/16438))
+* When calling the `process` helpers in an integration test the path needs to have
+ a leading slash. Previously you could omit it but that was a byproduct of the
+ implementation and not an intentional feature, e.g.:
+
+ ```ruby
+   test "list all posts" do
+     get "/posts"
+     assert_response :success 
+ end
+ ```
+
Action Mailer
-------------
@@ -655,8 +674,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
current environment.
([Commit](https://github.com/rails/rails/commit/e2f232aba15937a4b9d14bd91e0392c6d55be58d))
-* Introduced `ActiveRecord::Base#validate!` that raises `ActiveRecord::RecordInvalid` if the
- record is invalid.
+* Introduced `ActiveRecord::Base#validate!` that raises
+ `ActiveRecord::RecordInvalid` if the record is invalid.
([Pull Request](https://github.com/rails/rails/pull/8639))
* Introduced `validate` as an alias for `valid?`.
@@ -696,8 +715,8 @@ Please refer to the [Changelog][active-record] for detailed changes.
`SELECT`s.
([Pull Request](https://github.com/rails/rails/pull/15866))
-* `ActiveRecord::Base#reflections` now returns a hash with string keys instead of symbol keys.
- ([Pull Request](https://github.com/rails/rails/pull/17718))
+* `ActiveRecord::Base#reflections` now returns a hash with string keys instead
+ of symbol keys. ([Pull Request](https://github.com/rails/rails/pull/17718))
* The `references` method in migrations now supports a `type` option for
specifying the type of the foreign key (e.g. `:uuid`).