aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/4_2_release_notes.md41
-rw-r--r--guides/source/active_support_core_extensions.md4
-rw-r--r--guides/source/generators.md4
3 files changed, 27 insertions, 22 deletions
diff --git a/guides/source/4_2_release_notes.md b/guides/source/4_2_release_notes.md
index 1bb912b678..f4c2eb8945 100644
--- a/guides/source/4_2_release_notes.md
+++ b/guides/source/4_2_release_notes.md
@@ -55,9 +55,7 @@ for a full description.
Railties
--------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/railties/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][railties] for detailed changes.
### Removals
@@ -82,9 +80,7 @@ for detailed changes.
Action Pack
-----------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/actionpack/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][action-pack] for detailed changes.
### Deprecations
@@ -143,9 +139,7 @@ for detailed changes.
Action View
-------------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/actionview/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][action-view] for detailed changes.
### Deprecations
@@ -164,9 +158,7 @@ for detailed changes.
Action Mailer
-------------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/actionmailer/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][action-mailer] for detailed changes.
### Notable changes
@@ -262,12 +254,14 @@ for detailed changes.
* Added support for user-created range types in PostgreSQL adapter.
([Commit](https://github.com/rails/rails/commit/4cb47167e747e8f9dc12b0ddaf82bdb68c03e032))
+* Added a `:required` option to singular associations, which defines a
+ presence validation on the association.
+ ([Pull Request](https://github.com/rails/rails/pull/16056))
+
Active Model
------------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/activemodel/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][active-model] for detailed changes.
### Removals
@@ -283,9 +277,7 @@ for detailed changes.
Active Support
--------------
-Please refer to the
-[Changelog](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md)
-for detailed changes.
+Please refer to the [Changelog][active-support] for detailed changes.
### Removals
@@ -315,6 +307,11 @@ for detailed changes.
as well as `Kernel#concern` to avoid the `module Foo; extend ActiveSupport::Concern; end`
boilerplate. ([Commit](https://github.com/rails/rails/commit/b16c36e688970df2f96f793a759365b248b582ad))
+* Added `Hash#transform_values` and `Hash#transform_values!` to simplify a
+ common pattern where the values of a hash must change, but the keys are left
+ the same.
+ ([Pull Request](https://github.com/rails/rails/pull/15819))
+
Credits
-------
@@ -322,3 +319,11 @@ See the
[full list of contributors to Rails](http://contributors.rubyonrails.org/) for
the many people who spent many hours making Rails, the stable and robust
framework it is. Kudos to all of them.
+
+[railties]: https://github.com/rails/rails/blob/4-2-stable/railties/CHANGELOG.md
+[action-pack]: https://github.com/rails/rails/blob/4-2-stable/actionpack/CHANGELOG.md
+[action-view]: https://github.com/rails/rails/blob/4-2-stable/actionview/CHANGELOG.md
+[action-mailer]: https://github.com/rails/rails/blob/4-2-stable/actionmailer/CHANGELOG.md
+[active-record]: https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md
+[active-model]: https://github.com/rails/rails/blob/4-2-stable/activemodel/CHANGELOG.md
+[active-support]: https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md
diff --git a/guides/source/active_support_core_extensions.md b/guides/source/active_support_core_extensions.md
index 4f37bf971a..9537d9718c 100644
--- a/guides/source/active_support_core_extensions.md
+++ b/guides/source/active_support_core_extensions.md
@@ -3672,9 +3672,9 @@ t.advance(seconds: 1)
#### `Time.current`
-Active Support defines `Time.current` to be today in the current time zone. That's like `Time.now`, except that it honors the user time zone, if defined. It also defines `Time.yesterday` and `Time.tomorrow`, and the instance predicates `past?`, `today?`, and `future?`, all of them relative to `Time.current`.
+Active Support defines `Time.current` to be today in the current time zone. That's like `Time.now`, except that it honors the user time zone, if defined. It also defines the instance predicates `past?`, `today?`, and `future?`, all of them relative to `Time.current`.
-When making Time comparisons using methods which honor the user time zone, make sure to use `Time.current` and not `Time.now`. There are cases where the user time zone might be in the future compared to the system time zone, which `Time.today` uses by default. This means `Time.now` may equal `Time.yesterday`.
+When making Time comparisons using methods which honor the user time zone, make sure to use `Time.current` instead of `Time.now`. There are cases where the user time zone might be in the future compared to the system time zone, which `Time.now` uses by default. This means `Time.now.to_date` may equal `Date.yesterday`.
#### `all_day`, `all_week`, `all_month`, `all_quarter` and `all_year`
diff --git a/guides/source/generators.md b/guides/source/generators.md
index 25c67de993..93fb5eece8 100644
--- a/guides/source/generators.md
+++ b/guides/source/generators.md
@@ -207,7 +207,7 @@ $ bin/rails generate scaffold User name:string
Looking at this output, it's easy to understand how generators work in Rails 3.0 and above. The scaffold generator doesn't actually generate anything, it just invokes others to do the work. This allows us to add/replace/remove any of those invocations. For instance, the scaffold generator invokes the scaffold_controller generator, which invokes erb, test_unit and helper generators. Since each generator has a single responsibility, they are easy to reuse, avoiding code duplication.
-Our first customization on the workflow will be to stop generating stylesheets, javascripts and test fixtures for scaffolds. We can achieve that by changing our configuration to the following:
+Our first customization on the workflow will be to stop generating stylesheet, JavaScript and test fixture files for scaffolds. We can achieve that by changing our configuration to the following:
```ruby
config.generators do |g|
@@ -219,7 +219,7 @@ config.generators do |g|
end
```
-If we generate another resource with the scaffold generator, we can see that stylesheets, javascripts and fixtures are not created anymore. If you want to customize it further, for example to use DataMapper and RSpec instead of Active Record and TestUnit, it's just a matter of adding their gems to your application and configuring your generators.
+If we generate another resource with the scaffold generator, we can see that stylesheet, JavaScript and fixture files are not created anymore. If you want to customize it further, for example to use DataMapper and RSpec instead of Active Record and TestUnit, it's just a matter of adding their gems to your application and configuring your generators.
To demonstrate this, we are going to create a new helper generator that simply adds some instance variable readers. First, we create a generator within the rails namespace, as this is where rails searches for generators used as hooks: