From 30433253eda59656b1060d6ccc5e1b8e5913c331 Mon Sep 17 00:00:00 2001
From: Kirill Zhuravlov
Date: Wed, 23 Nov 2016 03:04:55 +0200
Subject: Add link to API documentation
Add a link to http://api.rubyonrails.org/classes/ActionController.html in the beginning of an article.
---
guides/source/action_controller_overview.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 40eb838d32..69c4a00c5f 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -61,7 +61,7 @@ end
The [Layouts & Rendering Guide](layouts_and_rendering.html) explains this in more detail.
-`ApplicationController` inherits from `ActionController::Base`, which defines a number of helpful methods. This guide will cover some of these, but if you're curious to see what's in there, you can see all of them in the API documentation or in the source itself.
+`ApplicationController` inherits from `ActionController::Base`, which defines a number of helpful methods. This guide will cover some of these, but if you're curious to see what's in there, you can see all of them in the [API documentation](http://api.rubyonrails.org/classes/ActionController.html) or in the source itself.
Only public methods are callable as actions. It is a best practice to lower the visibility of methods (with `private` or `protected`) which are not intended to be actions, like auxiliary methods or filters.
--
cgit v1.2.3
From ff7a0efced5f267752a7dfd9f3e63322391fc5b7 Mon Sep 17 00:00:00 2001
From: Prathamesh Sonpatki
Date: Tue, 21 Feb 2017 22:23:37 +0530
Subject: Add first draft of release notes for Rails 5.1 :tada:
[ci skip]
---
guides/source/5_1_release_notes.md | 98 ++++++++++++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
create mode 100644 guides/source/5_1_release_notes.md
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
new file mode 100644
index 0000000000..6733426aaa
--- /dev/null
+++ b/guides/source/5_1_release_notes.md
@@ -0,0 +1,98 @@
+**DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON http://guides.rubyonrails.org.**
+
+Ruby on Rails 5.1 Release Notes
+===============================
+
+Highlights in Rails 5.1:
+
+* Yarn Support
+* Optional Webpack support
+* jQuery no longer a default dependency
+* System tests
+* Encrypted secrets
+* Parameterized mailers
+* Direct & resolved routes
+* Unification of form_for and form_tag into form_with
+
+These release notes cover only the major changes. To learn about various bug
+fixes and changes, please refer to the change logs or check out the [list of
+commits](https://github.com/rails/rails/commits/5-1-stable) in the main Rails
+repository on GitHub.
+
+--------------------------------------------------------------------------------
+
+Upgrading to Rails 5.1
+----------------------
+
+ToDo
+
+Major Features
+--------------
+
+### Yarn Support
+
+### System tests
+
+### Encrypted secrets
+
+### Parameterized mailers
+
+### Direct & resolved routes
+
+Railties
+--------
+
+Please refer to the [Changelog][railties] for detailed changes.
+
+Action Pack
+-----------
+
+Please refer to the [Changelog][action-pack] for detailed changes.
+
+Action View
+-------------
+
+Please refer to the [Changelog][action-view] for detailed changes.
+
+Action Mailer
+-------------
+
+Please refer to the [Changelog][action-mailer] for detailed changes.
+
+Active Record
+-------------
+
+Please refer to the [Changelog][active-record] for detailed changes.
+
+Active Model
+------------
+
+Please refer to the [Changelog][active-model] for detailed changes.
+
+Active Job
+-----------
+
+Please refer to the [Changelog][active-job] for detailed changes.
+
+Active Support
+--------------
+
+Please refer to the [Changelog][active-support] for detailed changes.
+
+Credits
+-------
+
+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/5-1-stable/railties/CHANGELOG.md
+[action-pack]: https://github.com/rails/rails/blob/5-1-stable/actionpack/CHANGELOG.md
+[action-view]: https://github.com/rails/rails/blob/5-1-stable/actionview/CHANGELOG.md
+[action-mailer]: https://github.com/rails/rails/blob/5-1-stable/actionmailer/CHANGELOG.md
+[action-cable]: https://github.com/rails/rails/blob/5-1-stable/actioncable/CHANGELOG.md
+[active-record]: https://github.com/rails/rails/blob/5-1-stable/activerecord/CHANGELOG.md
+[active-model]: https://github.com/rails/rails/blob/5-1-stable/activemodel/CHANGELOG.md
+[active-support]: https://github.com/rails/rails/blob/5-1-stable/activesupport/CHANGELOG.md
+[active-job]: https://github.com/rails/rails/blob/5-1-stable/activejob/CHANGELOG.md
--
cgit v1.2.3
From d8fd067969c4be4d8c38624a7cb79f770e087760 Mon Sep 17 00:00:00 2001
From: Prathamesh Sonpatki
Date: Tue, 21 Feb 2017 22:38:30 +0530
Subject: Add PR links for major features [ci skip]
---
guides/source/5_1_release_notes.md | 11 +++++++++++
1 file changed, 11 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 6733426aaa..f195922dca 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -31,14 +31,25 @@ Major Features
### Yarn Support
+[Pull Request](https://github.com/rails/rails/pull/26836)
+
### System tests
+[Pull Request](https://github.com/rails/rails/pull/26703)
+
### Encrypted secrets
+[Pull Request](https://github.com/rails/rails/pull/28038)
+
### Parameterized mailers
+[Pull Request](https://github.com/rails/rails/pull/27825)
+
### Direct & resolved routes
+[Pull Request](https://github.com/rails/rails/pull/23138)
+
+
Railties
--------
--
cgit v1.2.3
From e1567d0d3a3c0ae1f4da1fb8b5b77a85767fb6ae Mon Sep 17 00:00:00 2001
From: Krzysztof Maicher
Date: Sat, 4 Mar 2017 17:26:23 +0100
Subject: Improve foreign key description in guides [ci skip]
---
guides/source/association_basics.md | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 73c9c10c1f..5794bfa666 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -582,14 +582,30 @@ class CreateBooks < ActiveRecord::Migration[5.0]
t.string :book_number
t.integer :author_id
end
-
- add_index :books, :author_id
end
end
```
If you create an association some time after you build the underlying model, you need to remember to create an `add_column` migration to provide the necessary foreign key.
+It's a good practice to add an index on the foreign key to improve queries
+performance and a foreign key constraint to ensure referential data integrity:
+
+```ruby
+class CreateBooks < ActiveRecord::Migration[5.0]
+ def change
+ create_table :books do |t|
+ t.datetime :published_at
+ t.string :book_number
+ t.integer :author_id
+ end
+
+ add_index :books, :author_id
+ add_foreign_key :books, :authors
+ end
+end
+```
+
#### Creating Join Tables for `has_and_belongs_to_many` Associations
If you create a `has_and_belongs_to_many` association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the `:join_table` option, Active Record creates the name by using the lexical book of the class names. So a join between author and book models will give the default join table name of "authors_books" because "a" outranks "b" in lexical ordering.
--
cgit v1.2.3
From 12cadc6f62da270eb7d9cfb010450f4123da75df Mon Sep 17 00:00:00 2001
From: "yuuji.yaginuma"
Date: Tue, 7 Mar 2017 15:40:52 +0900
Subject: Remove `:on` option that does ot exist [ci skip]
That option was removed in 0a683085b1db435b7371350b2799a0f248cd717a
---
guides/source/testing.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/testing.md b/guides/source/testing.md
index 3f53ccb242..4caf55ab12 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -658,8 +658,8 @@ end
The driver name is a required argument for `driven_by`. The optional arguments
that can be passed to `driven_by` are `:using` for the browser (this will only
-be used for non-headless drivers like Selenium), `:on` for the port Puma should
-use, and `:screen_size` to change the size of the screen for screenshots.
+be used for non-headless drivers like Selenium), and `:screen_size` to change
+the size of the screen for screenshots.
```ruby
require "test_helper"
--
cgit v1.2.3
From ac00659b1b2a5d410b6b12615279c7c058a72fe1 Mon Sep 17 00:00:00 2001
From: Shia
Date: Wed, 8 Mar 2017 10:54:06 +0900
Subject: Fix to use correct path with language on guide
---
guides/rails_guides/generator.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/rails_guides/generator.rb b/guides/rails_guides/generator.rb
index 28164a3cb4..35f014747c 100644
--- a/guides/rails_guides/generator.rb
+++ b/guides/rails_guides/generator.rb
@@ -73,7 +73,7 @@ module RailsGuides
@output_dir = "#{@guides_dir}/output"
@output_dir += "/kindle" if @kindle
- @source_dir += "/#{@language}" if @language
+ @output_dir += "/#{@language}" if @language
end
def create_output_dir_if_needed
--
cgit v1.2.3
From 37770bc8d13c5c7af024e66539c79f966718aec0 Mon Sep 17 00:00:00 2001
From: Xavier Noria
Date: Thu, 9 Mar 2017 09:22:33 +0100
Subject: force UTF-8 as external encoding in guides generation [ci skip]
See the rationale in the comment found in the patch.
---
guides/Rakefile | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/Rakefile b/guides/Rakefile
index ccb42f3273..0a591558e1 100644
--- a/guides/Rakefile
+++ b/guides/Rakefile
@@ -2,15 +2,28 @@ namespace :guides do
desc 'Generate guides (for authors), use ONLY=foo to process just "foo.md"'
task generate: "generate:html"
+ # Guides are written in UTF-8, but the environment may be configured for some
+ # other locale, these tasks are responsible for ensuring the default external
+ # encoding is UTF-8.
+ #
+ # Real use cases: Generation was reported to fail on a machine configured with
+ # GBK (Chinese). The docs server once got misconfigured somehow and had "C",
+ # which broke generation too.
+ task :encoding do
+ %w(LANG LANGUAGE LC_ALL).each do |env_var|
+ ENV[env_var] = "en_US.UTF-8"
+ end
+ end
+
namespace :generate do
desc "Generate HTML guides"
- task :html do
+ task :html => :encoding do
ENV["WARNINGS"] = "1" # authors can't disable this
ruby "rails_guides.rb"
end
desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/gp/feature.html?docId=1000765211"
- task :kindle do
+ task :kindle => :encoding do
require "kindlerb"
unless Kindlerb.kindlegen_available?
abort "Please run `setupkindlerb` to install kindlegen"
@@ -25,7 +38,7 @@ namespace :guides do
# Validate guides -------------------------------------------------------------------------
desc 'Validate guides, use ONLY=foo to process just "foo.html"'
- task :validate do
+ task :validate => :encoding do
ruby "w3c_validator.rb"
end
--
cgit v1.2.3
From 7724c8cb53093ba09f5b8f08feb8321d376d56dd Mon Sep 17 00:00:00 2001
From: Vipul A M
Date: Thu, 9 Mar 2017 20:05:13 +0530
Subject: Edits to Systems testing section [ci skip]
---
guides/source/testing.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/testing.md b/guides/source/testing.md
index f7640d097f..ada7c2da76 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -644,7 +644,7 @@ system tests should live.
If you want to change the default settings you can simply change what the system
tests are "driven by". Say you want to change the driver from Selenium to
-Poltergeist. First add the Poltergeist gem to your Gemfile. Then in your
+Poltergeist. First add the `poltergeist` gem to your Gemfile. Then in your
`application_system_test_case.rb` file do the following:
```ruby
@@ -722,7 +722,7 @@ class ArticlesTest < ApplicationSystemTestCase
end
```
-The test should see that there is an h1 on the articles index and pass.
+The test should see that there is an `h1` on the articles index page and pass.
Run the system tests.
@@ -760,7 +760,7 @@ text. Once the fields are filled in, "Create Article" is clicked on which will
send a POST request to create the new article in the database.
We will be redirected back to the the articles index page and there we assert
-that the text from the article title is on the articles index page.
+that the text from the new article's title is on the articles index page.
#### Taking it further
--
cgit v1.2.3
From dcc9bd35e248f9e038c0fbc6a2024cd2d5228cbc Mon Sep 17 00:00:00 2001
From: James Baer
Date: Fri, 10 Mar 2017 12:33:21 -0500
Subject: Improve readability of testing guide [ci skip]
Small change to improve the readability in section 2.3 of the testing
guide.
---
guides/source/testing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/testing.md b/guides/source/testing.md
index 4caf55ab12..27f5b5e916 100644
--- a/guides/source/testing.md
+++ b/guides/source/testing.md
@@ -123,7 +123,7 @@ def test_the_truth
end
```
-However only the `test` macro allows a more readable test name. You can still use regular method definitions though.
+Although you can still use regular method definitions, using the `test` macro allows for a more readable test name.
NOTE: The method name is generated by replacing spaces with underscores. The result does not need to be a valid Ruby identifier though, the name may contain punctuation characters etc. That's because in Ruby technically any string may be a method name. This may require use of `define_method` and `send` calls to function properly, but formally there's little restriction on the name.
--
cgit v1.2.3
From 5c2678056ac5d7af1a2f82a6e1e98401467cb5eb Mon Sep 17 00:00:00 2001
From: bogdanvlviv
Date: Sun, 12 Mar 2017 12:06:48 +0200
Subject: Fix typo in the security guide
[ci skip]
---
guides/source/security.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/security.md b/guides/source/security.md
index a81a782cf2..a57c6ea247 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -615,7 +615,7 @@ The two dashes start a comment ignoring everything after it. So the query return
Usually a web application includes access control. The user enters their login credentials and the web application tries to find the matching record in the users table. The application grants access when it finds a record. However, an attacker may possibly bypass this check with SQL injection. The following shows a typical database query in Rails to find the first record in the users table which matches the login credentials parameters supplied by the user.
```ruby
-User.first("login = '#{params[:name]}' AND password = '#{params[:password]}'")
+User.find_by("login = '#{params[:name]}' AND password = '#{params[:password]}'")
```
If an attacker enters ' OR '1'='1 as the name, and ' OR '2'>'1 as the password, the resulting SQL query will be:
@@ -762,7 +762,7 @@ s = sanitize(user_input, tags: tags, attributes: %w(href title))
This allows only the given tags and does a good job, even against all kinds of tricks and malformed tags.
-As a second step, _it is good practice to escape all output of the application_, especially when re-displaying user input, which hasn't been input-filtered (as in the search form example earlier on). _Use `escapeHTML()` (or its alias `h()`) method_ to replace the HTML input characters &, ", <, and > by their uninterpreted representations in HTML (`&`, `"`, `<`, and `>`).
+As a second step, _it is good practice to escape all output of the application_, especially when re-displaying user input, which hasn't been input-filtered (as in the search form example earlier on). _Use `escapeHTML()` (or its alias `h()`) method_ to replace the HTML input characters &, ", <, and > by their uninterpreted representations in HTML (`&`, `"`, `<`, and `>`).
##### Obfuscation and Encoding Injection
--
cgit v1.2.3
From 4d5060072b5446e0d13873f7edbecaf3527e7846 Mon Sep 17 00:00:00 2001
From: Vipul A M
Date: Sun, 12 Mar 2017 19:37:48 +0530
Subject: Add link to mentioned API [ci skip] (#28392)
---
guides/source/form_helpers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 8ad76ad01e..0508b0fb38 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -531,7 +531,7 @@ To leverage time zone support in Rails, you have to ask your users what time zon
<%= time_zone_select(:person, :time_zone) %>
```
-There is also `time_zone_options_for_select` helper for a more manual (therefore more customizable) way of doing this. Read the API documentation to learn about the possible arguments for these two methods.
+There is also `time_zone_options_for_select` helper for a more manual (therefore more customizable) way of doing this. Read the [API documentation](http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-time_zone_options_for_select) to learn about the possible arguments for these two methods.
Rails _used_ to have a `country_select` helper for choosing countries, but this has been extracted to the [country_select plugin](https://github.com/stefanpenner/country_select). When using this, be aware that the exclusion or inclusion of certain names from the list can be somewhat controversial (and was the reason this functionality was extracted from Rails).
--
cgit v1.2.3
From 8f9241b076c836a318649f26e7677ae1390c3b9a Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 12 Mar 2017 11:25:24 -0400
Subject: First editing pass on "Active Model Basics" guide
Lots of grammar, etc fixes.
[ci skip]
---
guides/source/active_model_basics.md | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md
index 72daa29f7f..a35d0e4067 100644
--- a/guides/source/active_model_basics.md
+++ b/guides/source/active_model_basics.md
@@ -87,7 +87,7 @@ end
### Conversion
If a class defines `persisted?` and `id` methods, then you can include the
-`ActiveModel::Conversion` module in that class and call the Rails conversion
+`ActiveModel::Conversion` module in that class, and call the Rails conversion
methods on objects of that class.
```ruby
@@ -132,7 +132,7 @@ class Person
end
def last_name
- @last_name
+ @last_nameperson.changes # => {"first_name"=>[nil, "First Name"]}
end
def last_name=(value)
@@ -156,16 +156,17 @@ person.changed? # => false
person.first_name = "First Name"
person.first_name # => "First Name"
-# returns true if any of the attributes have unsaved changes, false otherwise.
+# returns true if any of the attributes have unsaved changes.
person.changed? # => true
# returns a list of attributes that have changed before saving.
person.changed # => ["first_name"]
-# returns a hash of the attributes that have changed with their original values.
+# returns a Hash of the attributes that have changed with their original values.
person.changed_attributes # => {"first_name"=>nil}
-# returns a hash of changes, with the attribute names as the keys, and the values will be an array of the old and new value for that field.
+# returns a Hash of changes, with the attribute names as the keys, and the
+# values as an array of the old and new values for that field.
person.changes # => {"first_name"=>[nil, "First Name"]}
```
@@ -179,7 +180,7 @@ person.first_name # => "First Name"
person.first_name_changed? # => true
```
-Track what was the previous value of the attribute.
+Track the previous value of the attribute.
```ruby
# attr_name_was accessor
@@ -187,7 +188,7 @@ person.first_name_was # => nil
```
Track both previous and current value of the changed attribute. Returns an array
-if changed, else returns nil.
+if changed, otherwise returns nil.
```ruby
# attr_name_change
@@ -197,7 +198,7 @@ person.last_name_change # => nil
### Validations
-The `ActiveModel::Validations` module adds the ability to validate class objects
+The `ActiveModel::Validations` module adds the ability to validate objects
like in Active Record.
```ruby
@@ -225,7 +226,7 @@ person.valid? # => raises ActiveModel::StrictValidationFa
### Naming
-`ActiveModel::Naming` adds a number of class methods which make the naming and routing
+`ActiveModel::Naming` adds a number of class methods which make naming and routing
easier to manage. The module defines the `model_name` class method which
will define a number of accessors using some `ActiveSupport::Inflector` methods.
@@ -248,7 +249,7 @@ Person.model_name.singular_route_key # => "person"
### Model
-`ActiveModel::Model` adds the ability to a class to work with Action Pack and
+`ActiveModel::Model` adds the ability for a class to work with Action Pack and
Action View right out of the box.
```ruby
@@ -308,7 +309,7 @@ class Person
end
```
-Now you can access a serialized hash of your object using the `serializable_hash`.
+Now you can access a serialized hash of your object using the `serializable_hash` method.
```ruby
person = Person.new
--
cgit v1.2.3
From 21a44916ae39cb622c11c3e206a74925d114cfa8 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 12 Mar 2017 11:37:15 -0400
Subject: Second editing pass on "Active Model Basics" guide
Lots of grammar, etc fixes.
[ci skip]
---
guides/source/active_model_basics.md | 34 ++++++++++++++++++----------------
1 file changed, 18 insertions(+), 16 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md
index a35d0e4067..ce33734f41 100644
--- a/guides/source/active_model_basics.md
+++ b/guides/source/active_model_basics.md
@@ -294,7 +294,7 @@ objects.
### Serialization
`ActiveModel::Serialization` provides basic serialization for your object.
-You need to declare an attributes hash which contains the attributes you want to
+You need to declare an attributes Hash which contains the attributes you want to
serialize. Attributes must be strings, not symbols.
```ruby
@@ -309,7 +309,7 @@ class Person
end
```
-Now you can access a serialized hash of your object using the `serializable_hash` method.
+Now you can access a serialized Hash of your object using the `serializable_hash` method.
```ruby
person = Person.new
@@ -320,13 +320,14 @@ person.serializable_hash # => {"name"=>"Bob"}
#### ActiveModel::Serializers
-Rails provides an `ActiveModel::Serializers::JSON` serializer.
-This module automatically includes the `ActiveModel::Serialization`.
+Active Model also provides the `ActiveModel::Serializers::JSON` module
+for JSON serializing / deserializing. This module automatically includes the
+previously discussed `ActiveModel::Serialization` module.
##### ActiveModel::Serializers::JSON
-To use the `ActiveModel::Serializers::JSON` you only need to change from
-`ActiveModel::Serialization` to `ActiveModel::Serializers::JSON`.
+To use `ActiveModel::Serializers::JSON` you only need to change the
+module you are including from `ActiveModel::Serialization` to `ActiveModel::Serializers::JSON`.
```ruby
class Person
@@ -340,7 +341,8 @@ class Person
end
```
-With the `as_json` method you have a hash representing the model.
+The `as_json` method, similar to `serializable_hash`, provides a Hash representing
+the model.
```ruby
person = Person.new
@@ -349,8 +351,8 @@ person.name = "Bob"
person.as_json # => {"name"=>"Bob"}
```
-From a JSON string you define the attributes of the model.
-You need to have the `attributes=` method defined on your class:
+You can also define the attributes for a model from a JSON string.
+However, you need to define the `attributes=` method on your class:
```ruby
class Person
@@ -370,7 +372,7 @@ class Person
end
```
-Now it is possible to create an instance of person and set the attributes using `from_json`.
+Now it is possible to create an instance of `Person` and set attributes using `from_json`.
```ruby
json = { name: 'Bob' }.to_json
@@ -390,8 +392,8 @@ class Person
end
```
-With the `human_attribute_name` you can transform attribute names into a more
-human format. The human format is defined in your locale file.
+With the `human_attribute_name` method, you can transform attribute names into a
+more human-readable format. The human-readable format is defined in your locale file(s).
* config/locales/app.pt-BR.yml
@@ -412,7 +414,7 @@ Person.human_attribute_name('name') # => "Nome"
`ActiveModel::Lint::Tests` allows you to test whether an object is compliant with
the Active Model API.
-* app/models/person.rb
+* `app/models/person.rb`
```ruby
class Person
@@ -420,7 +422,7 @@ the Active Model API.
end
```
-* test/models/person_test.rb
+* `test/models/person_test.rb`
```ruby
require 'test_helper'
@@ -455,9 +457,9 @@ features out of the box.
### SecurePassword
`ActiveModel::SecurePassword` provides a way to securely store any
-password in an encrypted form. On including this module, a
+password in an encrypted form. When you include this module, a
`has_secure_password` class method is provided which defines
-an accessor named `password` with certain validations on it.
+a `password` accessor with certain validations on it.
#### Requirements
--
cgit v1.2.3
From 89d66410892b9c42bf2a11f7308d6c8bf8d656c8 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 12 Mar 2017 13:11:53 -0400
Subject: Fix weird documentation line
[ci skip]
---
guides/source/active_model_basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md
index ce33734f41..e26805d22c 100644
--- a/guides/source/active_model_basics.md
+++ b/guides/source/active_model_basics.md
@@ -132,7 +132,7 @@ class Person
end
def last_name
- @last_nameperson.changes # => {"first_name"=>[nil, "First Name"]}
+ @last_name
end
def last_name=(value)
--
cgit v1.2.3
From b4dbe8c7338f0b531d60dbae12031a51ab7a7dcc Mon Sep 17 00:00:00 2001
From: Prathamesh Sonpatki
Date: Fri, 3 Mar 2017 12:31:31 +0530
Subject: Add blurbs about each new feature [ci skip]
---
guides/source/5_1_release_notes.md | 158 +++++++++++++++++++++++++++++++++++++
1 file changed, 158 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index f195922dca..f3c8f1f155 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -33,22 +33,180 @@ Major Features
[Pull Request](https://github.com/rails/rails/pull/26836)
+Rails 5.1 will allow managing JavaScript dependencies
+from NPM via Yarn.This will make it easy to use libraries like React, VueJS
+or any other library from NPM world. The Yarn support is integrated with
+the asset pipeline so that all dependencies will work seamlessly with the
+Rails 5.1 app.
+
+### Optional Webpack support
+
+Rails apps can use Webpack easily now using the [Webpacker](https://github.com/rails/webpacker)
+gem. New Rails 5.1 app can be generated using `--webpack` switch to enable Webpack integration.
+
+This is fully compatible with the asset pipeline, which you can continue to use for
+images, fonts, sounds, whatever. You can even have some JavaScript on the asset pipeline
+and some done via Webpack. It’s all managed via Yarn that’s on by default.
+
+### jQuery no longer a default dependency
+
+jQuery was required by default in earlier versions of Rails to provide features like
+`data-remote`, `data-confirm` and other parts of Rails UJS. It is no longer required,
+as the `rails-ujs` is now written using plain vanilla JavaScript.
+
+You can still use jQuery if needed, but it is no longer required by default.
+
### System tests
[Pull Request](https://github.com/rails/rails/pull/26703)
+Rails 5.1 has support for writing Capybara tests baked in in the form of
+System tests. Now you don't have to worry about configuring Capybara and
+database cleaning strategies for such tests. Rails 5.1 provides a wrapper
+for running such tests in chrome with additional features such as failure
+screenshots.
+
### Encrypted secrets
[Pull Request](https://github.com/rails/rails/pull/28038)
+Rails will now allow management of application secrets in a secure way
+built on top of [sekrets](https://github.com/ahoward/sekrets) gem.
+
+Run `bin/rails secrets:setup` to setup a new encrypted secrets file. It will
+generate a master key which needs to be stored outside of the repository and it will
+allow checking in the actual secrets in the revision control.
+
+The secrets will be decrypted in production either using `RAILS_MASTER_KEY` from
+the ENV or injected key file.
+
### Parameterized mailers
[Pull Request](https://github.com/rails/rails/pull/27825)
+Allows specifying common params used for all methods in a mailer class
+to share instance variables, headers and other common setup.
+
+``` ruby
+class InvitationsMailer < ApplicationMailer
+
+ before_action { @inviter, @invitee = params[:inviter], params[:invitee] }
+ before_action { @account = params[:inviter].account }
+
+ def account_invitation
+ mail subject: "#{@inviter.name} invited you to their Basecamp (#{@account.name})"
+ end
+
+ def project_invitation
+ @project = params[:project]
+ @summarizer = ProjectInvitationSummarizer.new(@project.bucket)
+
+ mail subject: "#{@inviter.name.familiar} added you to a project in Basecamp (#{@account.name})"
+ end
+end
+
+InvitationsMailer.with(inviter: person_a, invitee: person_b).account_invitation.deliver_later
+```
+
### Direct & resolved routes
[Pull Request](https://github.com/rails/rails/pull/23138)
+Rails 5.1 has added two new methods - `resolve` and `direct` to the routing
+DSL.
+
+The `resolve` method allows customizing polymorphic mapping of models.
+
+``` ruby
+resource :basket
+
+resolve(class: "Basket") { [:basket] }
+```
+
+``` erb
+<%= form_for @basket do |form| %>
+
+<% end %>
+```
+
+This will generate the singular URL `/basket` instead of usual `/baskets/:id`.
+
+The `direct` method allows creation of custom URL helpers.
+
+``` ruby
+direct(:homepage) { "http://www.rubyonrails.org" }
+
+>> homepage_url
+=> "http://www.rubyonrails.org"
+```
+
+The return value of the block must be a valid argument for the `url_for`
+method. So you can pass a valid string URL, or a hash, or an array, or an
+Active Model instance or an Active Model class.
+
+``` ruby
+direct :commentable do |model|
+ [ model, anchor: model.dom_id ]
+end
+
+direct :main do
+ { controller: 'pages', action: 'index', subdomain: 'www' }
+end
+```
+
+### Unification of form_for and form_tag into form_with
+
+[Pull Request](https://github.com/rails/rails/pull/26976)
+
+Before Rails 5.1, there were two interfaces for handling HTML forms,
+`form_for` for model instances and `form_tag` for custom URLs.
+
+Rails 5.1 combines both of these interfaces with `form_with` and
+can generate form tags based on URLs, scopes or models.
+
+``` erb
+# Using just a URL:
+
+<%= form_with url: posts_path do |form| %>
+ <%= form.text_field :title %>
+<% end %>
+
+# =>
+
+
+# Adding a scope prefixes the input field names:
+
+<%= form_with scope: :post, url: posts_path do |form| %>
+ <%= form.text_field :title %>
+<% end %>
+# =>
+
+
+# Using a model infers both the URL and scope:
+
+<%= form_with model: Post.new do |form| %>
+ <%= form.text_field :title %>
+<% end %>
+# =>
+
+
+# An existing model makes an update form and fills out field values:
+
+<%= form_with model: Post.first do |form| %>
+ <%= form.text_field :title %>
+<% end %>
+# =>
+
+```
Railties
--------
--
cgit v1.2.3
From 96c525f2509a9ec1890c5218f6a65b22660b97f7 Mon Sep 17 00:00:00 2001
From: Philipe Fatio
Date: Tue, 14 Mar 2017 10:57:50 +0100
Subject: Remove obsolete warning about regular expression
This warning became obsolete when the regular expression was changed to
use `\z` instead of `\Z` in fce9c4e5e1ecb31cff2ca43a04fbe332816c3c45.
"-1234\n" =~ /\A[+-]?\d+\Z/ => 0
"-1234\n" =~ /\A[+-]?\d+\z/ => nil
[ci skip]
---
guides/source/active_record_validations.md | 3 ---
1 file changed, 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_record_validations.md b/guides/source/active_record_validations.md
index 32b38cde5e..5313361dfd 100644
--- a/guides/source/active_record_validations.md
+++ b/guides/source/active_record_validations.md
@@ -490,9 +490,6 @@ If you set `:only_integer` to `true`, then it will use the
regular expression to validate the attribute's value. Otherwise, it will try to
convert the value to a number using `Float`.
-WARNING. Note that the regular expression above allows a trailing newline
-character.
-
```ruby
class Player < ApplicationRecord
validates :points, numericality: true
--
cgit v1.2.3
From a05845e0a699e169c11962212200dc8e72934dff Mon Sep 17 00:00:00 2001
From: Eugene Kenny
Date: Wed, 15 Mar 2017 12:14:46 +0000
Subject: Remove unused `@txn` variable
This was added in c24c885209ac2334dc6f798c394a821ee270bec6, removed in
b89ffe7f0047eb614e42232a21201b317b880755, and then (unintentionally?)
reintroduced in 2d7ae1b08ee2a10b12cbfeef3a6cc6da55b57df6.
---
guides/source/debugging_rails_applications.md | 1 -
1 file changed, 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md
index ba0cdbf3af..33dee6a868 100644
--- a/guides/source/debugging_rails_applications.md
+++ b/guides/source/debugging_rails_applications.md
@@ -606,7 +606,6 @@ You can also inspect for an object method this way:
@new_record = true
@readonly = false
@transaction_state = nil
-@txn = nil
```
You can also use `display` to start watching variables. This is a good way of
--
cgit v1.2.3
From dcd6ceb0c90866272b3e75f9d34ef9f13cfb33c6 Mon Sep 17 00:00:00 2001
From: marksiemers
Date: Wed, 15 Mar 2017 12:38:49 -0700
Subject: Update 'Building Complex Forms' with `inverse_of`
If the example for complex forms is implemented, ActiveRecord will prevent saving unless `inverse_of: :person` is added to the `has_many :addresses` association.
---
guides/source/form_helpers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 0508b0fb38..95c2e33dc7 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -877,7 +877,7 @@ Active Record provides model level support via the `accepts_nested_attributes_fo
```ruby
class Person < ApplicationRecord
- has_many :addresses
+ has_many :addresses, inverse_of: :person
accepts_nested_attributes_for :addresses
end
--
cgit v1.2.3
From 5a072ba317aa180b3622145003fb3ed8b93d226f Mon Sep 17 00:00:00 2001
From: bogdanvlviv
Date: Tue, 7 Mar 2017 00:09:55 +0200
Subject: Remove ability update locking_column value
---
guides/source/active_record_querying.md | 3 ---
1 file changed, 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 31865ea375..2902c5d677 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -953,9 +953,6 @@ class Client < ApplicationRecord
end
```
-NOTE: Please note that the optimistic locking will be ignored if you update the
-locking column's value.
-
### Pessimistic Locking
Pessimistic locking uses a locking mechanism provided by the underlying database. Using `lock` when building a relation obtains an exclusive lock on the selected rows. Relations using `lock` are usually wrapped inside a transaction for preventing deadlock conditions.
--
cgit v1.2.3
From 5a09b3fd6b22dda7b77dfa47d6ace210ea84f43a Mon Sep 17 00:00:00 2001
From: marvin
Date: Thu, 16 Mar 2017 19:42:00 +0800
Subject: Fix asset_pipeline docs incorrect image dir info
---
guides/source/asset_pipeline.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/asset_pipeline.md b/guides/source/asset_pipeline.md
index 68dde4482f..61b7112247 100644
--- a/guides/source/asset_pipeline.md
+++ b/guides/source/asset_pipeline.md
@@ -335,7 +335,7 @@ an asset has been updated and if so loads it into the page:
<%= javascript_include_tag "application", "data-turbolinks-track" => "reload" %>
```
-In regular views you can access images in the `public/assets/images` directory
+In regular views you can access images in the `app/assets/images` directory
like this:
```erb
--
cgit v1.2.3
From 7b02f86680b2d712ea5b0ca541dc620f0a524b5a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
Date: Fri, 17 Mar 2017 13:14:51 -0400
Subject: Fix resolve usage in the release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index f3c8f1f155..6bd5321b92 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -120,7 +120,7 @@ The `resolve` method allows customizing polymorphic mapping of models.
``` ruby
resource :basket
-resolve(class: "Basket") { [:basket] }
+resolve("Basket") { [:basket] }
```
``` erb
--
cgit v1.2.3
From da7c4126d34c358cd83a0343af800c1c3d4ac5d8 Mon Sep 17 00:00:00 2001
From: James Baer
Date: Fri, 17 Mar 2017 16:02:24 -0400
Subject: Improve Caching with Rails Guides [ci skip]
Adds the "Caching in Development" section to
demonstrate usage of the dev:cache task in development mode.
Also, makes a small grammatical correction in section 2.4.
---
guides/source/caching_with_rails.md | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index fd7626250c..af4ef6a58d 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -396,7 +396,7 @@ config.cache_store = :file_store, "/path/to/cache/directory"
```
With this cache store, multiple server processes on the same host can share a
-cache. The cache store is appropriate for low to medium traffic sites that are
+cache. This cache store is appropriate for low to medium traffic sites that are
served off one or two hosts. Server processes running on different hosts could
share a cache by using a shared file system, but that setup is not recommended.
@@ -570,6 +570,20 @@ You can also set the strong ETag directly on the response.
response.strong_etag = response.body # => "618bbc92e2d35ea1945008b42799b0e7"
```
+Caching in Development
+----------------------
+
+It's common to want to test the caching strategy of your application
+in developement mode. Rails provides the rake task `dev:cache` to
+easily toggle caching on/off.
+
+```bash
+$ bin/rails dev:cache
+Development mode is now being cached.
+$ bin/rails dev:cache
+Development mode is no longer being cached.
+```
+
References
----------
--
cgit v1.2.3
From 33786f62f9a1f9bd855bc51da501fb6a0fd6d0bf Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 18 Mar 2017 22:07:20 -0400
Subject: First pass on 5.1 release notes
Fixing tons of grammar, etc.
[ci skip]
---
guides/source/5_1_release_notes.md | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 6bd5321b92..5b46cc57b2 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -41,20 +41,24 @@ Rails 5.1 app.
### Optional Webpack support
-Rails apps can use Webpack easily now using the [Webpacker](https://github.com/rails/webpacker)
-gem. New Rails 5.1 app can be generated using `--webpack` switch to enable Webpack integration.
+Rails apps can integrate with [Webpack](https://webpack.js.org/), a JavaScript
+asset bundler, more easily using the new [Webpacker](https://github.com/rails/webpacker)
+gem. Use the `--webpack` flag when generating new applications to enable Webpack
+integration.
This is fully compatible with the asset pipeline, which you can continue to use for
-images, fonts, sounds, whatever. You can even have some JavaScript on the asset pipeline
-and some done via Webpack. It’s all managed via Yarn that’s on by default.
+images, fonts, sounds, and other assets. You can even have some JavaScript code
+managed by the asset pipeline, and other code processed via Webpack. It’s all managed via Yarn that’s on by default.
### jQuery no longer a default dependency
-jQuery was required by default in earlier versions of Rails to provide features like
-`data-remote`, `data-confirm` and other parts of Rails UJS. It is no longer required,
-as the `rails-ujs` is now written using plain vanilla JavaScript.
+jQuery was required by default in earlier versions of Rails to provide features
+like `data-remote`, `data-confirm` and other parts of Rails' Unobtrusive JavaScript
+offerings. It is no longer required, as the UJS has been rewritten to use plain,
+vanilla JavaScript. This code now ships inside of Action View as
+`rails-ujs`.
-You can still use jQuery if needed, but it is no longer required by default.
+You can still use jQuery version if needed, but it is no longer required by default.
### System tests
@@ -63,7 +67,7 @@ You can still use jQuery if needed, but it is no longer required by default.
Rails 5.1 has support for writing Capybara tests baked in in the form of
System tests. Now you don't have to worry about configuring Capybara and
database cleaning strategies for such tests. Rails 5.1 provides a wrapper
-for running such tests in chrome with additional features such as failure
+for running tests in Chrome with additional features such as failure
screenshots.
### Encrypted secrets
@@ -71,14 +75,14 @@ screenshots.
[Pull Request](https://github.com/rails/rails/pull/28038)
Rails will now allow management of application secrets in a secure way
-built on top of [sekrets](https://github.com/ahoward/sekrets) gem.
+built on top of the [sekrets](https://github.com/ahoward/sekrets) gem.
Run `bin/rails secrets:setup` to setup a new encrypted secrets file. It will
-generate a master key which needs to be stored outside of the repository and it will
+generate a master key which needs to be stored outside of the repository, and it will
allow checking in the actual secrets in the revision control.
-The secrets will be decrypted in production either using `RAILS_MASTER_KEY` from
-the ENV or injected key file.
+The secrets will be decrypted in production using either the `RAILS_MASTER_KEY`
+environment variable from a key file.
### Parameterized mailers
@@ -112,7 +116,7 @@ InvitationsMailer.with(inviter: person_a, invitee: person_b).account_invitation.
[Pull Request](https://github.com/rails/rails/pull/23138)
-Rails 5.1 has added two new methods - `resolve` and `direct` to the routing
+Rails 5.1 has added two new methods, `resolve` and `direct`, to the routing
DSL.
The `resolve` method allows customizing polymorphic mapping of models.
--
cgit v1.2.3
From cb12b2a075956cac23da86648028b45e8ee30f69 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 18 Mar 2017 22:09:53 -0400
Subject: Second pass on 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 5b46cc57b2..1b6eb76e32 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -133,7 +133,7 @@ resolve("Basket") { [:basket] }
<% end %>
```
-This will generate the singular URL `/basket` instead of usual `/baskets/:id`.
+This will generate the singular URL `/basket` instead of the usual `/baskets/:id`.
The `direct` method allows creation of custom URL helpers.
@@ -145,8 +145,8 @@ direct(:homepage) { "http://www.rubyonrails.org" }
```
The return value of the block must be a valid argument for the `url_for`
-method. So you can pass a valid string URL, or a hash, or an array, or an
-Active Model instance or an Active Model class.
+method. So, you can pass a valid string URL, Hash, array, an
+Active Model instance, or an Active Model class.
``` ruby
direct :commentable do |model|
@@ -162,10 +162,10 @@ end
[Pull Request](https://github.com/rails/rails/pull/26976)
-Before Rails 5.1, there were two interfaces for handling HTML forms,
+Before Rails 5.1, there were two interfaces for handling HTML forms:
`form_for` for model instances and `form_tag` for custom URLs.
-Rails 5.1 combines both of these interfaces with `form_with` and
+Rails 5.1 combines both of these interfaces with `form_with`, and
can generate form tags based on URLs, scopes or models.
``` erb
--
cgit v1.2.3
From 061927b4a84770c71f26e706e8720e56eed32b58 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 18 Mar 2017 22:15:27 -0400
Subject: Add link to Webpack/Webpacker PR
[ci skip]
---
guides/source/5_1_release_notes.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 1b6eb76e32..d072c67108 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -41,6 +41,8 @@ Rails 5.1 app.
### Optional Webpack support
+[Pull Request](https://github.com/rails/rails/pull/27288)
+
Rails apps can integrate with [Webpack](https://webpack.js.org/), a JavaScript
asset bundler, more easily using the new [Webpacker](https://github.com/rails/webpacker)
gem. Use the `--webpack` flag when generating new applications to enable Webpack
--
cgit v1.2.3
From 5e8dfcd12d1c496cf811a32f9f22de6a40d5abd3 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 18 Mar 2017 22:20:01 -0400
Subject: Add link to rails-ujs/dropping jQuery PR
[ci skip]
---
guides/source/5_1_release_notes.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index d072c67108..0216f04761 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -54,6 +54,8 @@ managed by the asset pipeline, and other code processed via Webpack. It’s all
### jQuery no longer a default dependency
+[Pull Request](https://github.com/rails/rails/pull/27113)
+
jQuery was required by default in earlier versions of Rails to provide features
like `data-remote`, `data-confirm` and other parts of Rails' Unobtrusive JavaScript
offerings. It is no longer required, as the UJS has been rewritten to use plain,
--
cgit v1.2.3
From 9cc2f50f9cc3191fd796af68d09826c67c02a572 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 18 Mar 2017 22:41:15 -0400
Subject: Update some jquery-ujs references to rails-ujs
[ci skip]
---
guides/source/action_mailer_basics.md | 5 +++--
guides/source/security.md | 13 ++++++-------
guides/source/working_with_javascript_in_rails.md | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
(limited to 'guides')
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index 380fdac658..9673571909 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -550,8 +550,9 @@ url helper.
<%= user_url(@user, host: 'example.com') %>
```
-NOTE: non-`GET` links require [jQuery UJS](https://github.com/rails/jquery-ujs)
-and won't work in mailer templates. They will result in normal `GET` requests.
+NOTE: non-`GET` links require [rails-ujs](https://github.com/rails/rails-ujs) or
+[jQuery UJS](https://github.com/rails/jquery-ujs), and won't work in mailer templates.
+They will result in normal `GET` requests.
### Adding images in Action Mailer Views
diff --git a/guides/source/security.md b/guides/source/security.md
index a57c6ea247..a14134f8c1 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -257,13 +257,12 @@ protect_from_forgery with: :exception
This will automatically include a security token in all forms and Ajax requests generated by Rails. If the security token doesn't match what was expected, an exception will be thrown.
-NOTE: By default, Rails includes jQuery and an [unobtrusive scripting adapter for
-jQuery](https://github.com/rails/jquery-ujs), which adds a header called
-`X-CSRF-Token` on every non-GET Ajax call made by jQuery with the security token.
-Without this header, non-GET Ajax requests won't be accepted by Rails. When using
-another library to make Ajax calls, it is necessary to add the security token as
-a default header for Ajax calls in your library. To get the token, have a look at
-`` tag printed by
+NOTE: By default, Rails includes an [unobtrusive scripting adapter](https://github.com/rails/rails-ujs),
+which adds a header called `X-CSRF-Token` with the security token on every non-GET
+Ajax call. Without this header, non-GET Ajax requests won't be accepted by Rails.
+When using another library to make Ajax calls, it is necessary to add the security
+token as a default header for Ajax calls in your library. To get the token, have
+a look at `` tag printed by
`<%= csrf_meta_tags %>` in your application view.
It is common to use persistent cookies to store user information, with `cookies.permanent` for example. In this case, the cookies will not be cleared and the out of the box CSRF protection will not be effective. If you are using a different cookie store than the session for this information, you must handle what to do with it yourself:
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index c1dfcab6f3..e04b3e3581 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -149,7 +149,7 @@ Because of Unobtrusive JavaScript, the Rails "Ajax helpers" are actually in two
parts: the JavaScript half and the Ruby half.
Unless you have disabled the Asset Pipeline,
-[rails.js](https://github.com/rails/jquery-ujs/blob/master/src/rails.js)
+[rails-ujs](https://github.com/rails/rails-ujs/blob/master/src/rails-ujs.coffee)
provides the JavaScript half, and the regular Ruby view helpers add appropriate
tags to your DOM.
--
cgit v1.2.3
From aa56c89eb2691ffccdd60e72d5c17118edbf1b63 Mon Sep 17 00:00:00 2001
From: Simon Dawson
Date: Sun, 19 Mar 2017 08:31:49 +0000
Subject: Minor grammar fixes for Rails 5.1 release notes
---
guides/source/5_1_release_notes.md | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 0216f04761..5d4885d55c 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -34,7 +34,7 @@ Major Features
[Pull Request](https://github.com/rails/rails/pull/26836)
Rails 5.1 will allow managing JavaScript dependencies
-from NPM via Yarn.This will make it easy to use libraries like React, VueJS
+from NPM via Yarn. This will make it easy to use libraries like React, VueJS
or any other library from NPM world. The Yarn support is integrated with
the asset pipeline so that all dependencies will work seamlessly with the
Rails 5.1 app.
@@ -50,7 +50,8 @@ integration.
This is fully compatible with the asset pipeline, which you can continue to use for
images, fonts, sounds, and other assets. You can even have some JavaScript code
-managed by the asset pipeline, and other code processed via Webpack. It’s all managed via Yarn that’s on by default.
+managed by the asset pipeline, and other code processed via Webpack. All of this is managed
+by Yarn, which is enabled by default.
### jQuery no longer a default dependency
@@ -62,14 +63,14 @@ offerings. It is no longer required, as the UJS has been rewritten to use plain,
vanilla JavaScript. This code now ships inside of Action View as
`rails-ujs`.
-You can still use jQuery version if needed, but it is no longer required by default.
+You can still use the jQuery version if needed, but it is no longer required by default.
### System tests
[Pull Request](https://github.com/rails/rails/pull/26703)
-Rails 5.1 has support for writing Capybara tests baked in in the form of
-System tests. Now you don't have to worry about configuring Capybara and
+Rails 5.1 has baked-in support for writing Capybara tests, in the form of
+System tests. You need no longer worry about configuring Capybara and
database cleaning strategies for such tests. Rails 5.1 provides a wrapper
for running tests in Chrome with additional features such as failure
screenshots.
@@ -78,15 +79,16 @@ screenshots.
[Pull Request](https://github.com/rails/rails/pull/28038)
-Rails will now allow management of application secrets in a secure way
-built on top of the [sekrets](https://github.com/ahoward/sekrets) gem.
+Rails will now allow management of application secrets in a secure way,
+building on top of the [sekrets](https://github.com/ahoward/sekrets) gem.
-Run `bin/rails secrets:setup` to setup a new encrypted secrets file. It will
-generate a master key which needs to be stored outside of the repository, and it will
-allow checking in the actual secrets in the revision control.
+Run `bin/rails secrets:setup` to setup a new encrypted secrets file. This will
+also generate a master key, which must be stored outside of the repository. The
+secrets themselves can then be safely checked into the revision control system,
+in an encrypted form.
-The secrets will be decrypted in production using either the `RAILS_MASTER_KEY`
-environment variable from a key file.
+Secrets will be decrypted in production, using a key stored either in the
+`RAILS_MASTER_KEY` environment variable, or in a key file.
### Parameterized mailers
@@ -149,7 +151,7 @@ direct(:homepage) { "http://www.rubyonrails.org" }
```
The return value of the block must be a valid argument for the `url_for`
-method. So, you can pass a valid string URL, Hash, array, an
+method. So, you can pass a valid string URL, Hash, Array, an
Active Model instance, or an Active Model class.
``` ruby
--
cgit v1.2.3
From 8ee16836982b79a14198c75006672677f1f55947 Mon Sep 17 00:00:00 2001
From: Simon Dawson
Date: Sun, 19 Mar 2017 08:34:47 +0000
Subject: Remove stray back-end from ActiveJob Basics guide
The hyphenated form "back-end" only appears once in this guide; elsewhere, the un-hyphenated form "backend" is used consistently.
---
guides/source/active_job_basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/active_job_basics.md b/guides/source/active_job_basics.md
index c65d1e6de5..b58ca61848 100644
--- a/guides/source/active_job_basics.md
+++ b/guides/source/active_job_basics.md
@@ -114,7 +114,7 @@ For enqueuing and executing jobs in production you need to set up a queuing back
that is to say you need to decide for a 3rd-party queuing library that Rails should use.
Rails itself only provides an in-process queuing system, which only keeps the jobs in RAM.
If the process crashes or the machine is reset, then all outstanding jobs are lost with the
-default async back-end. This may be fine for smaller apps or non-critical jobs, but most
+default async backend. This may be fine for smaller apps or non-critical jobs, but most
production apps will need to pick a persistent backend.
### Backends
--
cgit v1.2.3
From 5c0d00072d1309dbc77bb5d97e42956bac3e8684 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
Date: Mon, 20 Mar 2017 15:04:57 -0400
Subject: Update the maintenance policy [ci skip]
---
guides/source/maintenance_policy.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/maintenance_policy.md b/guides/source/maintenance_policy.md
index 7ced3eab1c..1d6a4edb5b 100644
--- a/guides/source/maintenance_policy.md
+++ b/guides/source/maintenance_policy.md
@@ -44,7 +44,7 @@ from.
In special situations, where someone from the Core Team agrees to support more series,
they are included in the list of supported series.
-**Currently included series:** `5.0.Z`, `4.2.Z`.
+**Currently included series:** `5.1.Z`.
Security Issues
---------------
@@ -59,7 +59,7 @@ be built from 1.2.2, and then added to the end of 1-2-stable. This means that
security releases are easy to upgrade to if you're running the latest version
of Rails.
-**Currently included series:** `5.0.Z`, `4.2.Z`.
+**Currently included series:** `5.1.Z`, `5.0.Z`.
Severe Security Issues
----------------------
@@ -68,7 +68,7 @@ For severe security issues we will provide new versions as above, and also the
last major release series will receive patches and new versions. The
classification of the security issue is judged by the core team.
-**Currently included series:** `5.0.Z`, `4.2.Z`.
+**Currently included series:** `5.1.Z`, `5.0.Z`, `4.2.Z`.
Unsupported Release Series
--------------------------
--
cgit v1.2.3
From 17545b4d889149d8185c0a3a78030703d7e70c0e Mon Sep 17 00:00:00 2001
From: Erol Fornoles
Date: Tue, 21 Mar 2017 09:21:51 +0800
Subject: Fix typo in Caching with Rails Guide [skip ci]
---
guides/source/caching_with_rails.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index af4ef6a58d..aa79f59e4f 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -574,7 +574,7 @@ Caching in Development
----------------------
It's common to want to test the caching strategy of your application
-in developement mode. Rails provides the rake task `dev:cache` to
+in development mode. Rails provides the rake task `dev:cache` to
easily toggle caching on/off.
```bash
--
cgit v1.2.3
From 3b51c8a591b0b79fa6d9f42f948b6b733dfae936 Mon Sep 17 00:00:00 2001
From: Hendy Tanata
Date: Tue, 21 Mar 2017 08:49:48 -0700
Subject: Update Configuring Rails Component guide example
config.time_zone is no longer in included in config/application.rb.
See 28dcadc0140dfdebe87d5e691fd709c0a9ae0bae.
---
guides/source/configuring.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index a4f3882124..ae70b06996 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -32,7 +32,7 @@ Configuring Rails Components
In general, the work of configuring Rails means configuring the components of Rails, as well as configuring Rails itself. The configuration file `config/application.rb` and environment-specific configuration files (such as `config/environments/production.rb`) allow you to specify the various settings that you want to pass down to all of the components.
-For example, the `config/application.rb` file includes this setting:
+For example, you could add this setting to `config/application.rb` file:
```ruby
config.time_zone = 'Central Time (US & Canada)'
--
cgit v1.2.3
From 6c08d480f13d3332c878ca8a120a03fcd78f7ba2 Mon Sep 17 00:00:00 2001
From: Matthew Draper
Date: Wed, 22 Mar 2017 10:11:39 +1030
Subject: Start Rails 5.2 development
---
guides/CHANGELOG.md | 7 +------
guides/bug_report_templates/action_controller_master.rb | 1 +
guides/bug_report_templates/active_job_master.rb | 1 +
guides/bug_report_templates/active_record_master.rb | 1 +
guides/bug_report_templates/active_record_migrations_master.rb | 1 +
guides/bug_report_templates/generic_master.rb | 1 +
6 files changed, 6 insertions(+), 6 deletions(-)
(limited to 'guides')
diff --git a/guides/CHANGELOG.md b/guides/CHANGELOG.md
index 3a602efb3d..d8b122d264 100644
--- a/guides/CHANGELOG.md
+++ b/guides/CHANGELOG.md
@@ -1,6 +1 @@
-## Rails 5.1.0.beta1 (February 23, 2017) ##
-
-* No changes.
-
-
-Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/guides/CHANGELOG.md) for previous changes.
+Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/guides/CHANGELOG.md) for previous changes.
diff --git a/guides/bug_report_templates/action_controller_master.rb b/guides/bug_report_templates/action_controller_master.rb
index 486c7243ad..7644f6fe4a 100644
--- a/guides/bug_report_templates/action_controller_master.rb
+++ b/guides/bug_report_templates/action_controller_master.rb
@@ -8,6 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "action_controller/railtie"
diff --git a/guides/bug_report_templates/active_job_master.rb b/guides/bug_report_templates/active_job_master.rb
index f61518713f..7591470440 100644
--- a/guides/bug_report_templates/active_job_master.rb
+++ b/guides/bug_report_templates/active_job_master.rb
@@ -8,6 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "active_job"
diff --git a/guides/bug_report_templates/active_record_master.rb b/guides/bug_report_templates/active_record_master.rb
index 7265a671b0..8bbc1ef19e 100644
--- a/guides/bug_report_templates/active_record_master.rb
+++ b/guides/bug_report_templates/active_record_master.rb
@@ -8,6 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
gem "sqlite3"
end
diff --git a/guides/bug_report_templates/active_record_migrations_master.rb b/guides/bug_report_templates/active_record_migrations_master.rb
index 13a375d1ba..84a4b71909 100644
--- a/guides/bug_report_templates/active_record_migrations_master.rb
+++ b/guides/bug_report_templates/active_record_migrations_master.rb
@@ -8,6 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
gem "sqlite3"
end
diff --git a/guides/bug_report_templates/generic_master.rb b/guides/bug_report_templates/generic_master.rb
index d3a7ae4ac4..ed45726e92 100644
--- a/guides/bug_report_templates/generic_master.rb
+++ b/guides/bug_report_templates/generic_master.rb
@@ -8,6 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
gem "rails", github: "rails/rails"
+ gem "arel", github: "rails/arel"
end
require "active_support"
--
cgit v1.2.3
From afbbcf24d791362a65c7f29b739c73a5b09e3816 Mon Sep 17 00:00:00 2001
From: Matthew Draper
Date: Wed, 22 Mar 2017 10:11:43 +1030
Subject: Update bug report templates
---
guides/bug_report_templates/action_controller_gem.rb | 2 +-
guides/bug_report_templates/active_job_gem.rb | 2 +-
guides/bug_report_templates/active_record_gem.rb | 2 +-
guides/bug_report_templates/active_record_migrations_gem.rb | 2 +-
guides/bug_report_templates/generic_gem.rb | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
(limited to 'guides')
diff --git a/guides/bug_report_templates/action_controller_gem.rb b/guides/bug_report_templates/action_controller_gem.rb
index 85d698f81b..46fabca3e8 100644
--- a/guides/bug_report_templates/action_controller_gem.rb
+++ b/guides/bug_report_templates/action_controller_gem.rb
@@ -8,7 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
- gem "rails", "5.0.1"
+ gem "rails", "5.1.0.rc1"
end
require "rack/test"
diff --git a/guides/bug_report_templates/active_job_gem.rb b/guides/bug_report_templates/active_job_gem.rb
index f715caec95..71fe356ea0 100644
--- a/guides/bug_report_templates/active_job_gem.rb
+++ b/guides/bug_report_templates/active_job_gem.rb
@@ -8,7 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
- gem "activejob", "5.0.1"
+ gem "activejob", "5.1.0.rc1"
end
require "minitest/autorun"
diff --git a/guides/bug_report_templates/active_record_gem.rb b/guides/bug_report_templates/active_record_gem.rb
index 98edcb76b1..a685c257ea 100644
--- a/guides/bug_report_templates/active_record_gem.rb
+++ b/guides/bug_report_templates/active_record_gem.rb
@@ -8,7 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
- gem "activerecord", "5.0.1"
+ gem "activerecord", "5.1.0.rc1"
gem "sqlite3"
end
diff --git a/guides/bug_report_templates/active_record_migrations_gem.rb b/guides/bug_report_templates/active_record_migrations_gem.rb
index ece6ae4f12..b4e822dfe0 100644
--- a/guides/bug_report_templates/active_record_migrations_gem.rb
+++ b/guides/bug_report_templates/active_record_migrations_gem.rb
@@ -8,7 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
- gem "activerecord", "5.0.1"
+ gem "activerecord", "5.1.0.rc1"
gem "sqlite3"
end
diff --git a/guides/bug_report_templates/generic_gem.rb b/guides/bug_report_templates/generic_gem.rb
index fa9f94eea0..e1b705bea4 100644
--- a/guides/bug_report_templates/generic_gem.rb
+++ b/guides/bug_report_templates/generic_gem.rb
@@ -8,7 +8,7 @@ end
gemfile(true) do
source "https://rubygems.org"
# Activate the gem you are reporting the issue against.
- gem "activesupport", "5.0.1"
+ gem "activesupport", "5.1.0.rc1"
end
require "active_support/core_ext/object/blank"
--
cgit v1.2.3
From 9e14f42a2ece637829eb8db307a105f321a0f77f Mon Sep 17 00:00:00 2001
From: brchristian
Date: Thu, 23 Mar 2017 10:00:04 -0700
Subject: Additional explanation about cache implementations
---
guides/source/caching_with_rails.md | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index aa79f59e4f..798fea9f30 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -387,6 +387,11 @@ store is not appropriate for large application deployments. However, it can
work well for small, low traffic sites with only a couple of server processes,
as well as development and test environments.
+New Rails projects will be configured to use this implementation in the
+development environment by default. (Note that, because processes will not share
+cache data, if using `:memory_store` it will not be possible to manually read,
+write or expire the cache via the Rails console.)
+
### ActiveSupport::Cache::FileStore
This cache store uses the file system to store entries. The path to the directory where the store files will be stored must be specified when initializing the cache.
@@ -403,7 +408,8 @@ share a cache by using a shared file system, but that setup is not recommended.
As the cache will grow until the disk is full, it is recommended to
periodically clear out old entries.
-This is the default cache store implementation.
+This is the default cache store implementation (at `"#{root}/tmp/cache/"`) if
+no explicit `config.cache_store` is supplied.
### ActiveSupport::Cache::MemCacheStore
--
cgit v1.2.3
From aed7bb67485b1e4d4c7eeb40971ac4057d48999c Mon Sep 17 00:00:00 2001
From: Rachel Carvalho
Date: Thu, 23 Mar 2017 16:21:11 -0400
Subject: update guide to reflect browser compatibility for HTTP verbs [ci
skip]
---
guides/source/security.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/security.md b/guides/source/security.md
index a14134f8c1..7e27e6f37d 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -212,7 +212,7 @@ CSRF appears very rarely in CVE (Common Vulnerabilities and Exposures) - less th
NOTE: _First, as is required by the W3C, use GET and POST appropriately. Secondly, a security token in non-GET requests will protect your application from CSRF._
-The HTTP protocol basically provides two main types of requests - GET and POST (and more, but they are not supported by most browsers). The World Wide Web Consortium (W3C) provides a checklist for choosing HTTP GET or POST:
+The HTTP protocol basically provides two main types of requests - GET and POST (DELETE, PUT, and PATCH should be used like POST). The World Wide Web Consortium (W3C) provides a checklist for choosing HTTP GET or POST:
**Use GET if:**
@@ -224,7 +224,7 @@ The HTTP protocol basically provides two main types of requests - GET and POST (
* The interaction _changes the state_ of the resource in a way that the user would perceive (e.g., a subscription to a service), or
* The user is _held accountable for the results_ of the interaction.
-If your web application is RESTful, you might be used to additional HTTP verbs, such as PATCH, PUT or DELETE. Most of today's web browsers, however, do not support them - only GET and POST. Rails uses a hidden `_method` field to handle this barrier.
+If your web application is RESTful, you might be used to additional HTTP verbs, such as PATCH, PUT or DELETE. Some legacy web browsers, however, do not support them - only GET and POST. Rails uses a hidden `_method` field to handle these cases.
_POST requests can be sent automatically, too_. In this example, the link www.harmless.com is shown as the destination in the browser's status bar. But it has actually dynamically created a new form that sends a POST request.
--
cgit v1.2.3
From 684de497a8c60c9cb367ff2e3657fb785c2a35ea Mon Sep 17 00:00:00 2001
From: Vipul A M
Date: Fri, 24 Mar 2017 18:14:01 +0530
Subject: Doc cleanup for caching guide [ci skip] (#28556)
---
guides/source/caching_with_rails.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'guides')
diff --git a/guides/source/caching_with_rails.md b/guides/source/caching_with_rails.md
index 798fea9f30..6cdce5c2f4 100644
--- a/guides/source/caching_with_rails.md
+++ b/guides/source/caching_with_rails.md
@@ -387,10 +387,10 @@ store is not appropriate for large application deployments. However, it can
work well for small, low traffic sites with only a couple of server processes,
as well as development and test environments.
-New Rails projects will be configured to use this implementation in the
-development environment by default. (Note that, because processes will not share
-cache data, if using `:memory_store` it will not be possible to manually read,
-write or expire the cache via the Rails console.)
+New Rails projects are configured to use this implementation in development environment by default.
+
+NOTE: Since processes will not share cache data when using `:memory_store`,
+it will not be possible to manually read, write or expire the cache via the Rails console.
### ActiveSupport::Cache::FileStore
--
cgit v1.2.3
From c096262f614a0c307f89691e9b8e976b3be3f89f Mon Sep 17 00:00:00 2001
From: "yuuji.yaginuma"
Date: Sat, 25 Mar 2017 20:57:40 +0900
Subject: Rename local variable name `current_user` to `verified_user` [ci
skip]
Related #28570
---
guides/source/action_cable_overview.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/action_cable_overview.md b/guides/source/action_cable_overview.md
index e929945dd0..50a28571b4 100644
--- a/guides/source/action_cable_overview.md
+++ b/guides/source/action_cable_overview.md
@@ -6,7 +6,7 @@ incorporate real-time features into your Rails application.
After reading this guide, you will know:
-* What Action Cable is and its integration on backend and frontend
+* What Action Cable is and its integration on backend and frontend
* How to setup Action Cable
* How to setup channels
* Deployment and Architecture setup for running Action Cable
@@ -64,8 +64,8 @@ module ApplicationCable
private
def find_verified_user
- if current_user = User.find_by(id: cookies.signed[:user_id])
- current_user
+ if verified_user = User.find_by(id: cookies.signed[:user_id])
+ verified_user
else
reject_unauthorized_connection
end
--
cgit v1.2.3
From f116d36c93a316302239de9ef17bf1f19aef3b45 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 25 Mar 2017 11:27:28 -0400
Subject: Add WIP Rails 5.1 release notes to documents.yaml
[ci skip]
---
guides/source/documents.yaml | 5 +++++
1 file changed, 5 insertions(+)
(limited to 'guides')
diff --git a/guides/source/documents.yaml b/guides/source/documents.yaml
index 2925fb4b58..5fccdcccec 100644
--- a/guides/source/documents.yaml
+++ b/guides/source/documents.yaml
@@ -193,6 +193,11 @@
name: Upgrading Ruby on Rails
url: upgrading_ruby_on_rails.html
description: This guide helps in upgrading applications to latest Ruby on Rails versions.
+ -
+ name: Ruby on Rails 5.1 Release Notes
+ url: 5_1_release_notes.html
+ description: Release notes for Rails 5.1.
+ work_in_progress: true
-
name: Ruby on Rails 5.0 Release Notes
url: 5_0_release_notes.html
--
cgit v1.2.3
From aaa9a5b5d80f168e71593a75b06de94ab6129bca Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 25 Mar 2017 11:45:46 -0400
Subject: Upgrade various Rails 5.0 references to 5.1
RC1 is out, `5-1-stable` has been created, figured it was time to start
updating this stuff :)
[ci skip]
---
guides/source/_welcome.html.erb | 3 ++-
guides/source/command_line.md | 8 ++++----
guides/source/debugging_rails_applications.md | 12 ++++++------
guides/source/getting_started.md | 2 +-
4 files changed, 13 insertions(+), 12 deletions(-)
(limited to 'guides')
diff --git a/guides/source/_welcome.html.erb b/guides/source/_welcome.html.erb
index 5bd1ea4d22..8afec00018 100644
--- a/guides/source/_welcome.html.erb
+++ b/guides/source/_welcome.html.erb
@@ -10,12 +10,13 @@
<% else %>
- These are the new guides for Rails 5.0 based on <%= @version %>.
+ These are the new guides for Rails 5.1 based on <%= @version %>.
These guides are designed to make you immediately productive with Rails, and to help you understand how all of the pieces fit together.
<% end %>
The guides for earlier releases:
+Rails 5.0,
Rails 4.2,
Rails 4.1,
Rails 4.0,
diff --git a/guides/source/command_line.md b/guides/source/command_line.md
index c8d559745e..e28547e14f 100644
--- a/guides/source/command_line.md
+++ b/guides/source/command_line.md
@@ -63,7 +63,7 @@ With no further work, `rails server` will run our new shiny Rails app:
$ cd commandsapp
$ bin/rails server
=> Booting Puma
-=> Rails 5.0.0 application starting in development on http://0.0.0.0:3000
+=> Rails 5.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.0.2 (ruby 2.3.0-p0), codename: Plethora of Penguin Pinatas
@@ -294,7 +294,7 @@ If you wish to test out some code without changing any data, you can do that by
```bash
$ bin/rails console --sandbox
-Loading development environment in sandbox (Rails 5.0.0)
+Loading development environment in sandbox (Rails 5.1.0)
Any modifications you make will be rolled back on exit
irb(main):001:0>
```
@@ -428,10 +428,10 @@ INFO: You can also use `bin/rails -T` to get the list of tasks.
```bash
$ bin/rails about
About your application's environment
-Rails version 5.0.0
+Rails version 5.1.0
Ruby version 2.2.2 (x86_64-linux)
RubyGems version 2.4.6
-Rack version 1.6
+Rack version 2.0.1
JavaScript Runtime Node.js (V8)
Middleware Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, #, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root /home/foobar/commandsapp
diff --git a/guides/source/debugging_rails_applications.md b/guides/source/debugging_rails_applications.md
index 33dee6a868..58aab774b3 100644
--- a/guides/source/debugging_rails_applications.md
+++ b/guides/source/debugging_rails_applications.md
@@ -313,7 +313,7 @@ For example:
```bash
=> Booting Puma
-=> Rails 5.0.0 application starting in development on http://0.0.0.0:3000
+=> Rails 5.1.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.4.0 (ruby 2.3.1-p112), codename: Owl Bowl Brawl
@@ -445,11 +445,11 @@ then `backtrace` will supply the answer.
--> #0 ArticlesController.index
at /PathToProject/app/controllers/articles_controller.rb:8
#1 ActionController::BasicImplicitRender.send_action(method#String, *args#Array)
- at /PathToGems/actionpack-5.0.0/lib/action_controller/metal/basic_implicit_render.rb:4
+ at /PathToGems/actionpack-5.1.0/lib/action_controller/metal/basic_implicit_render.rb:4
#2 AbstractController::Base.process_action(action#NilClass, *args#Array)
- at /PathToGems/actionpack-5.0.0/lib/abstract_controller/base.rb:181
+ at /PathToGems/actionpack-5.1.0/lib/abstract_controller/base.rb:181
#3 ActionController::Rendering.process_action(action, *args)
- at /PathToGems/actionpack-5.0.0/lib/action_controller/metal/rendering.rb:30
+ at /PathToGems/actionpack-5.1.0/lib/action_controller/metal/rendering.rb:30
...
```
@@ -461,7 +461,7 @@ context.
```
(byebug) frame 2
-[176, 185] in /PathToGems/actionpack-5.0.0/lib/abstract_controller/base.rb
+[176, 185] in /PathToGems/actionpack-5.1.0/lib/abstract_controller/base.rb
176: # is the intended way to override action dispatching.
177: #
178: # Notice that the first argument is the method to be dispatched
@@ -676,7 +676,7 @@ Ruby instruction to be executed -- in this case, Active Support's `week` method.
```
(byebug) step
-[49, 58] in /PathToGems/activesupport-5.0.0/lib/active_support/core_ext/numeric/time.rb
+[49, 58] in /PathToGems/activesupport-5.1.0/lib/active_support/core_ext/numeric/time.rb
49:
50: # Returns a Duration instance matching the number of weeks provided.
51: #
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 57b8472462..068114898d 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -127,7 +127,7 @@ run the following:
$ rails --version
```
-If it says something like "Rails 5.0.0", you are ready to continue.
+If it says something like "Rails 5.1.0", you are ready to continue.
### Creating the Blog Application
--
cgit v1.2.3
From 430f1e02fafd30a08edfa2b1e8032eb7e0e729cc Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 25 Mar 2017 11:52:16 -0400
Subject: Update middleware list
Taken from `bin/rails about` run on a v5.1.0.rc1 application.
[ci skip]
---
guides/source/command_line.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/command_line.md b/guides/source/command_line.md
index e28547e14f..3360496c08 100644
--- a/guides/source/command_line.md
+++ b/guides/source/command_line.md
@@ -433,7 +433,7 @@ Ruby version 2.2.2 (x86_64-linux)
RubyGems version 2.4.6
Rack version 2.0.1
JavaScript Runtime Node.js (V8)
-Middleware Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, #, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, Rack::Head, Rack::ConditionalGet, Rack::ETag
+Middleware: Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root /home/foobar/commandsapp
Environment development
Database adapter sqlite3
--
cgit v1.2.3
From b8c330cb69c1b4e4cdfe30872db2a36d119b9c1b Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 25 Mar 2017 12:17:37 -0400
Subject: Small grammar fix
Add necessary commas.
[ci skip]
---
guides/source/contributing_to_ruby_on_rails.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index fe5437ae5d..9ffc86aa08 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -98,13 +98,13 @@ Anything you can do to make bug reports more succinct or easier to reproduce hel
### Testing Patches
-You can also help out by examining pull requests that have been submitted to Ruby on Rails via GitHub. To apply someone's changes you need first to create a dedicated branch:
+You can also help out by examining pull requests that have been submitted to Ruby on Rails via GitHub. In order to apply someone's changes, you need to first create a dedicated branch:
```bash
$ git checkout -b testing_branch
```
-Then you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to a topic branch "orange" located at https://github.com/JohnSmith/rails.
+Then, you can use their remote branch to update your codebase. For example, let's say the GitHub user JohnSmith has forked and pushed to a topic branch "orange" located at https://github.com/JohnSmith/rails.
```bash
$ git remote add JohnSmith https://github.com/JohnSmith/rails.git
--
cgit v1.2.3
From 3f27c9cbe97010bff0a6fa4d770f3ce3c3703b31 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 25 Mar 2017 12:18:29 -0400
Subject: Small grammar fix
Add apostrophe.
[ci skip]
---
guides/source/contributing_to_ruby_on_rails.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 9ffc86aa08..3b19b0dff1 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -15,7 +15,7 @@ After reading this guide, you will know:
Ruby on Rails is not "someone else's framework." Over the years, hundreds of people have contributed to Ruby on Rails ranging from a single character to massive architectural changes or significant documentation - all with the goal of making Ruby on Rails better for everyone. Even if you don't feel up to writing code or documentation yet, there are a variety of other ways that you can contribute, from reporting issues to testing patches.
-As mentioned in [Rails
+As mentioned in [Rails'
README](https://github.com/rails/rails/blob/master/README.md), everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails [code of conduct](http://rubyonrails.org/conduct/).
--------------------------------------------------------------------------------
--
cgit v1.2.3
From 2b3a3738b7a519f32f593f6e6b9c6ba89daa72ea Mon Sep 17 00:00:00 2001
From: Frederik Wille
Date: Wed, 29 Mar 2017 15:46:10 +0200
Subject: add hint on after_action filters
Adds a hint that ``after_action``-callbacks are not executed when an
exception was raised in the rest of the request cycle. The
``before_action`` section mentions "If there are additional filters
scheduled to run after that filter, they are also cancelled." but this
is IMO not sufficient.
---
guides/source/action_controller_overview.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index 69c4a00c5f..a43a69b7a3 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -719,7 +719,7 @@ Now, the `LoginsController`'s `new` and `create` actions will work as before wit
In addition to "before" filters, you can also run filters after an action has been executed, or both before and after.
-"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running.
+"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action but not when an exception was raised in the request cycle.
"around" filters are responsible for running their associated actions by yielding, similar to how Rack middlewares work.
--
cgit v1.2.3
From 40f226ae94a726ca8935062a8aac50af8cad1de9 Mon Sep 17 00:00:00 2001
From: Ryunosuke Sato
Date: Thu, 30 Mar 2017 01:10:20 +0900
Subject: Fix link to rails-ujs
https://github.com/rails/rails-ujs is merged into actionview in favor of https://github.com/rails/rails/pull/28098.
[skip ci]
---
guides/source/action_mailer_basics.md | 2 +-
guides/source/security.md | 2 +-
guides/source/working_with_javascript_in_rails.md | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/action_mailer_basics.md b/guides/source/action_mailer_basics.md
index 9673571909..65146ee7da 100644
--- a/guides/source/action_mailer_basics.md
+++ b/guides/source/action_mailer_basics.md
@@ -550,7 +550,7 @@ url helper.
<%= user_url(@user, host: 'example.com') %>
```
-NOTE: non-`GET` links require [rails-ujs](https://github.com/rails/rails-ujs) or
+NOTE: non-`GET` links require [rails-ujs](https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts) or
[jQuery UJS](https://github.com/rails/jquery-ujs), and won't work in mailer templates.
They will result in normal `GET` requests.
diff --git a/guides/source/security.md b/guides/source/security.md
index 7e27e6f37d..c305350243 100644
--- a/guides/source/security.md
+++ b/guides/source/security.md
@@ -257,7 +257,7 @@ protect_from_forgery with: :exception
This will automatically include a security token in all forms and Ajax requests generated by Rails. If the security token doesn't match what was expected, an exception will be thrown.
-NOTE: By default, Rails includes an [unobtrusive scripting adapter](https://github.com/rails/rails-ujs),
+NOTE: By default, Rails includes an [unobtrusive scripting adapter](https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts),
which adds a header called `X-CSRF-Token` with the security token on every non-GET
Ajax call. Without this header, non-GET Ajax requests won't be accepted by Rails.
When using another library to make Ajax calls, it is necessary to add the security
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index e04b3e3581..cbaf9100f7 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -149,7 +149,7 @@ Because of Unobtrusive JavaScript, the Rails "Ajax helpers" are actually in two
parts: the JavaScript half and the Ruby half.
Unless you have disabled the Asset Pipeline,
-[rails-ujs](https://github.com/rails/rails-ujs/blob/master/src/rails-ujs.coffee)
+[rails-ujs](https://github.com/rails/rails/blob/master/actionview/app/assets/javascripts/rails-ujs.coffee)
provides the JavaScript half, and the regular Ruby view helpers add appropriate
tags to your DOM.
--
cgit v1.2.3
From f77a6be8d23f048ced4fac54f1f4caea5e0749d7 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Wed, 29 Mar 2017 16:14:06 -0400
Subject: Small grammar fix
Add comma and change verb.
[ci skip]
---
guides/source/action_controller_overview.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/action_controller_overview.md b/guides/source/action_controller_overview.md
index a43a69b7a3..5d987264f5 100644
--- a/guides/source/action_controller_overview.md
+++ b/guides/source/action_controller_overview.md
@@ -719,7 +719,7 @@ Now, the `LoginsController`'s `new` and `create` actions will work as before wit
In addition to "before" filters, you can also run filters after an action has been executed, or both before and after.
-"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action but not when an exception was raised in the request cycle.
+"after" filters are similar to "before" filters, but because the action has already been run they have access to the response data that's about to be sent to the client. Obviously, "after" filters cannot stop the action from running. Please note that "after" filters are executed only after a successful action, but not when an exception is raised in the request cycle.
"around" filters are responsible for running their associated actions by yielding, similar to how Rack middlewares work.
--
cgit v1.2.3
From b68aae003ad7456f6c365fa86d212fd1e5a46ff7 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Thu, 30 Mar 2017 15:57:32 -0400
Subject: Small grammar fix
[ci skip]
---
guides/source/routing.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 86492a9332..53735ce82e 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -545,7 +545,7 @@ TIP: If you find yourself adding many extra actions to a resourceful route, it's
Non-Resourceful Routes
----------------------
-In addition to resource routing, Rails has powerful support for routing arbitrary URLs to actions. Here, you don't get groups of routes automatically generated by resourceful routing. Instead, you set up each route within your application separately.
+In addition to resource routing, Rails has powerful support for routing arbitrary URLs to actions. Here, you don't get groups of routes automatically generated by resourceful routing. Instead, you set up each route separately within your application.
While you should usually use resourceful routing, there are still many places where the simpler routing is more appropriate. There's no need to try to shoehorn every last piece of your application into a resourceful framework if that's not a good fit.
--
cgit v1.2.3
From 9aeba503c4bc321e4c5a14cd9c9fbf9fbcc60edb Mon Sep 17 00:00:00 2001
From: Ross Kaffenberger
Date: Fri, 31 Mar 2017 18:11:15 -0400
Subject: Add default_scope note to AR guide [ci skip]
Adds note to explain unexpected behavior described in issue #28561.
Developers may be surprised that the internal representation of similar
query conditions in Hash and Array formats in default_scope will yield
different results for model initialization.
Link: https://github.com/rails/rails/issues/28561
---
guides/source/active_record_querying.md | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_record_querying.md b/guides/source/active_record_querying.md
index 2902c5d677..26d01d4ede 100644
--- a/guides/source/active_record_querying.md
+++ b/guides/source/active_record_querying.md
@@ -1381,8 +1381,9 @@ class Client < ApplicationRecord
end
```
-NOTE: The `default_scope` is also applied while creating/building a record.
-It is not applied while updating a record. E.g.:
+NOTE: The `default_scope` is also applied while creating/building a record
+when the scope arguments are given as a `Hash`. It is not applied while
+updating a record. E.g.:
```ruby
class Client < ApplicationRecord
@@ -1393,6 +1394,17 @@ Client.new # => #
Client.unscoped.new # => #
```
+Be aware that, when given in the `Array` format, `default_scope` query arguments
+cannot be converted to a `Hash` for default attribute assignment. E.g.:
+
+```ruby
+class Client < ApplicationRecord
+ default_scope { where("active = ?", true) }
+end
+
+Client.new # => #
+```
+
### Merging of scopes
Just like `where` clauses scopes are merged using `AND` conditions.
--
cgit v1.2.3
From b5c56090ee5f71134b85e3cdf7e3b89093649fac Mon Sep 17 00:00:00 2001
From: Ruy Diaz
Date: Sat, 1 Apr 2017 21:35:20 -0700
Subject: Add anchor links to all headers
To allow easy linking at all levels and not just from index
---
guides/assets/stylesheets/main.css | 3 +++
guides/rails_guides/markdown.rb | 4 ++++
2 files changed, 7 insertions(+)
(limited to 'guides')
diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css
index b56699a0d0..a1e4851833 100644
--- a/guides/assets/stylesheets/main.css
+++ b/guides/assets/stylesheets/main.css
@@ -294,6 +294,9 @@ a, a:link, a:visited {
#mainCol a, #subCol a, #feature a {color: #980905;}
#mainCol a code, #subCol a code, #feature a code {color: #980905;}
+#mainCol a.anchorlink { text-decoration: none; }
+#mainCol a.anchorlink:hover { text-decoration: underline; }
+
/* Navigation
--------------------------------------- */
diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb
index bf2cc82c7c..16aaa7d1eb 100644
--- a/guides/rails_guides/markdown.rb
+++ b/guides/rails_guides/markdown.rb
@@ -105,6 +105,10 @@ module RailsGuides
node.inner_html = "#{node_index(hierarchy)} #{node.inner_html}"
end
end
+
+ doc.css('h3, h4, h5, h6').each do |node|
+ node.inner_html = "#{node.inner_html}"
+ end
end.to_html
end
end
--
cgit v1.2.3
From f2e6f5fb3fec7c16467d3a776164551236eb93be Mon Sep 17 00:00:00 2001
From: Ruy Diaz
Date: Tue, 4 Apr 2017 10:53:41 -0700
Subject: Downplay links in Guides headers
[ci skip]
---
guides/assets/stylesheets/main.css | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css
index a1e4851833..d428da3b56 100644
--- a/guides/assets/stylesheets/main.css
+++ b/guides/assets/stylesheets/main.css
@@ -294,7 +294,10 @@ a, a:link, a:visited {
#mainCol a, #subCol a, #feature a {color: #980905;}
#mainCol a code, #subCol a code, #feature a code {color: #980905;}
-#mainCol a.anchorlink { text-decoration: none; }
+#mainCol a.anchorlink {
+ color: #333;
+ text-decoration: none;
+}
#mainCol a.anchorlink:hover { text-decoration: underline; }
/* Navigation
--
cgit v1.2.3
From 0a61a321c7135d1eb04e7ef8caab07a1ef486ff7 Mon Sep 17 00:00:00 2001
From: claudiob
Date: Tue, 4 Apr 2017 12:09:17 -0700
Subject: Don't highlight code in anchorlink [ci skip]
Minor fix to #28662
---
guides/assets/stylesheets/main.css | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
(limited to 'guides')
diff --git a/guides/assets/stylesheets/main.css b/guides/assets/stylesheets/main.css
index d428da3b56..b27776745a 100644
--- a/guides/assets/stylesheets/main.css
+++ b/guides/assets/stylesheets/main.css
@@ -294,10 +294,8 @@ a, a:link, a:visited {
#mainCol a, #subCol a, #feature a {color: #980905;}
#mainCol a code, #subCol a code, #feature a code {color: #980905;}
-#mainCol a.anchorlink {
- color: #333;
- text-decoration: none;
-}
+#mainCol a.anchorlink, #mainCol a.anchorlink code {color: #333;}
+#mainCol a.anchorlink { text-decoration: none; }
#mainCol a.anchorlink:hover { text-decoration: underline; }
/* Navigation
--
cgit v1.2.3
From 3820abd36d22ac133b4146c8d59c1dda847e4f91 Mon Sep 17 00:00:00 2001
From: Alessandro Dal Grande
Date: Tue, 4 Apr 2017 16:21:08 -0700
Subject: Fix edge guides for Active Record callbacks
---
guides/source/active_record_callbacks.md | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 77bd3c97e8..de0ef7c4e5 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -254,7 +254,11 @@ Halting Execution
As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model's validations, the registered callbacks, and the database operation to be executed.
-The whole callback chain is wrapped in a transaction. If any _before_ callback method returns exactly `false` or raises an exception, the execution chain gets halted and a ROLLBACK is issued; _after_ callbacks can only accomplish that by raising an exception.
+The whole callback chain is wrapped in a transaction. If any callback raises an exception, the execution chain gets halted and a ROLLBACK is issued. To intentionally stop a chain use:
+
+```ruby
+throw :abort
+```
WARNING. Any exception that is not `ActiveRecord::Rollback` or `ActiveRecord::RecordInvalid` will be re-raised by Rails after the callback chain is halted. Raising an exception other than `ActiveRecord::Rollback` or `ActiveRecord::RecordInvalid` may break code that does not expect methods like `save` and `update_attributes` (which normally try to return `true` or `false`) to raise an exception.
--
cgit v1.2.3
From b4038ab37ac4e869632238071a3d6714a152a0a5 Mon Sep 17 00:00:00 2001
From: Kevin Reintjes
Date: Mon, 27 Feb 2017 17:45:24 +0100
Subject: Correct Autoloading and STI guide (issue #26994)
---
guides/source/autoloading_and_reloading_constants.md | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
(limited to 'guides')
diff --git a/guides/source/autoloading_and_reloading_constants.md b/guides/source/autoloading_and_reloading_constants.md
index 61657023e7..05743ee4ce 100644
--- a/guides/source/autoloading_and_reloading_constants.md
+++ b/guides/source/autoloading_and_reloading_constants.md
@@ -983,20 +983,19 @@ WHERE "polygons"."type" IN ("Rectangle")
That is not a bug, the query includes all *known* descendants of `Rectangle`.
A way to ensure this works correctly regardless of the order of execution is to
-load the leaves of the tree by hand at the bottom of the file that defines the
-root class:
+manually load the direct subclasses at the bottom of the file that defines each
+intermediate class:
```ruby
-# app/models/polygon.rb
-class Polygon < ApplicationRecord
+# app/models/rectangle.rb
+class Rectangle < Polygon
end
-require_dependency ‘square’
+require_dependency 'square'
```
-Only the leaves that are **at least grandchildren** need to be loaded this
-way. Direct subclasses do not need to be preloaded. If the hierarchy is
-deeper, intermediate classes will be autoloaded recursively from the bottom
-because their constant will appear in the class definitions as superclass.
+This needs to happen for every intermediate (non-root and non-leaf) class. The
+root class does not scope the query by type, and therefore does not necessarily
+have to know all its descendants.
### Autoloading and `require`
--
cgit v1.2.3
From 0b4ff7eacfeb36fca86c597da7c3ace059f8517a Mon Sep 17 00:00:00 2001
From: claudiob
Date: Fri, 7 Apr 2017 09:18:19 -0700
Subject: Fix Guides to include #23138 [ci skip]
A long-standing bug has been fixed in Rails 5.1 by @pixeltrix
See https://github.com/rails/rails/blame/5-1-stable/actionpack/CHANGELOG.md#L52-L64
This PR updates the guides accordingly.
Before:
After:
---
guides/source/routing.md | 9 +--------
1 file changed, 1 insertion(+), 8 deletions(-)
(limited to 'guides')
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 53735ce82e..545f53a8e0 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -152,6 +152,7 @@ This resourceful route:
```ruby
resource :geocoder
+resolve('Geocoder') { [:geocoder] }
```
creates six different routes in your application, all mapping to the `Geocoders` controller:
@@ -175,14 +176,6 @@ A singular resourceful route generates these helpers:
As with plural resources, the same helpers ending in `_url` will also include the host, port and path prefix.
-WARNING: A [long-standing bug](https://github.com/rails/rails/issues/1769) prevents `form_for` from working automatically with singular resources. As a workaround, specify the URL for the form directly, like so:
-
-```ruby
-form_for @geocoder, url: geocoder_path do |f|
-
-# snippet for brevity
-```
-
### Controller Namespaces and Routing
You may wish to organize groups of controllers under a namespace. Most commonly, you might group a number of administrative controllers under an `Admin::` namespace. You would place these controllers under the `app/controllers/admin` directory, and you can group them together in your router:
--
cgit v1.2.3
From 6f71e508a1272170dc93a31c5fc677f7f802d9eb Mon Sep 17 00:00:00 2001
From: Mikhail Dieterle
Date: Sat, 8 Apr 2017 14:11:36 +0300
Subject: [ci skip] Change ++ by markdown quotes
---
guides/source/active_model_basics.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/active_model_basics.md b/guides/source/active_model_basics.md
index e26805d22c..b8f076a27b 100644
--- a/guides/source/active_model_basics.md
+++ b/guides/source/active_model_basics.md
@@ -469,7 +469,7 @@ In order to make this work, the model must have an accessor named `password_dige
The `has_secure_password` will add the following validations on the `password` accessor:
1. Password should be present.
-2. Password should be equal to its confirmation (provided +password_confirmation+ is passed along).
+2. Password should be equal to its confirmation (provided `password_confirmation` is passed along).
3. The maximum length of a password is 72 (required by `bcrypt` on which ActiveModel::SecurePassword depends)
#### Examples
--
cgit v1.2.3
From 668f8691f1017042e238497d1a5b7b8bf1c43819 Mon Sep 17 00:00:00 2001
From: Matthew Draper
Date: Sun, 9 Apr 2017 00:31:58 +0930
Subject: Remove mentions and instructions for docrails
It's been retired; all contributions now come in via PRs.
---
guides/source/api_documentation_guidelines.md | 4 ----
guides/source/contributing_to_ruby_on_rails.md | 16 ++--------------
2 files changed, 2 insertions(+), 18 deletions(-)
(limited to 'guides')
diff --git a/guides/source/api_documentation_guidelines.md b/guides/source/api_documentation_guidelines.md
index 34b9c0d2ca..3c61754982 100644
--- a/guides/source/api_documentation_guidelines.md
+++ b/guides/source/api_documentation_guidelines.md
@@ -333,10 +333,6 @@ As a contributor, it's important to think about whether this API is meant for en
A class or module is marked with `:nodoc:` to indicate that all methods are internal API and should never be used directly.
-If you come across an existing `:nodoc:` you should tread lightly. Consider asking someone from the core team or author of the code before removing it. This should almost always happen through a pull request instead of the docrails project.
-
-A `:nodoc:` should never be added simply because a method or class is missing documentation. There may be an instance where an internal public method wasn't given a `:nodoc:` by mistake, for example when switching a method from private to public visibility. When this happens it should be discussed over a PR on a case-by-case basis and never committed directly to docrails.
-
To summarize, the Rails team uses `:nodoc:` to mark publicly visible methods and classes for internal use; changes to the visibility of API should be considered carefully and discussed over a pull request first.
Regarding the Rails Stack
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 3b19b0dff1..2e8228a698 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -132,24 +132,12 @@ learn about Ruby on Rails, and the API, which serves as a reference.
You can help improve the Rails guides by making them more coherent, consistent or readable, adding missing information, correcting factual errors, fixing typos, or bringing them up to date with the latest edge Rails.
-You can either open a pull request to [Rails](https://github.com/rails/rails) or
-ask the [Rails core team](http://rubyonrails.org/community/#core) for commit access on
-docrails if you contribute regularly.
-Please do not open pull requests in docrails, if you'd like to get feedback on your
-change, ask for it in [Rails](https://github.com/rails/rails) instead.
-
-Docrails is merged with master regularly, so you are effectively editing the Ruby on Rails documentation.
-
-If you are unsure of the documentation changes, you can create an issue in the [Rails](https://github.com/rails/rails/issues) issues tracker on GitHub.
+To do so, open a pull request to [Rails](https://github.com/rails/rails) on GitHub.
When working with documentation, please take into account the [API Documentation Guidelines](api_documentation_guidelines.html) and the [Ruby on Rails Guides Guidelines](ruby_on_rails_guides_guidelines.html).
-NOTE: As explained earlier, ordinary code patches should have proper documentation coverage. Docrails is only used for isolated documentation improvements.
-
NOTE: To help our CI servers you should add [ci skip] to your documentation commit message to skip build on that commit. Please remember to use it for commits containing only documentation changes.
-WARNING: Docrails has a very strict policy: no code can be touched whatsoever, no matter how trivial or small the change. Only RDoc and guides can be edited via docrails. Also, CHANGELOGs should never be edited in docrails.
-
Translating Rails Guides
------------------------
@@ -685,4 +673,4 @@ And then... think about your next contribution!
Rails Contributors
------------------
-All contributions, either via master or docrails, get credit in [Rails Contributors](http://contributors.rubyonrails.org).
+All contributions get credit in [Rails Contributors](http://contributors.rubyonrails.org).
--
cgit v1.2.3
From 24eb450d7599bab1f5863e0578a21c65ca42a915 Mon Sep 17 00:00:00 2001
From: Matthew Draper
Date: Sun, 9 Apr 2017 00:36:45 +0930
Subject: Drop the "Sanity Check" contributing step
---
guides/source/contributing_to_ruby_on_rails.md | 10 ----------
1 file changed, 10 deletions(-)
(limited to 'guides')
diff --git a/guides/source/contributing_to_ruby_on_rails.md b/guides/source/contributing_to_ruby_on_rails.md
index 2e8228a698..39f4272b3c 100644
--- a/guides/source/contributing_to_ruby_on_rails.md
+++ b/guides/source/contributing_to_ruby_on_rails.md
@@ -406,16 +406,6 @@ examples or multiple paragraphs. Otherwise, it's best to make a new paragraph.
Some changes require the dependencies to be upgraded. In these cases make sure you run `bundle update` to get the right version of the dependency and commit the `Gemfile.lock` file within your changes.
-### Sanity Check
-
-You should not be the only person who looks at the code before you submit it.
-If you know someone else who uses Rails, try asking them if they'll check out
-your work. If you don't know anyone else using Rails, try hopping into the IRC
-room or posting about your idea to the rails-core mailing list. Doing this in
-private before you push a patch out publicly is the "smoke test" for a patch:
-if you can't convince one other developer of the beauty of your code, you’re
-unlikely to convince the core team either.
-
### Commit Your Changes
When you're happy with the code on your computer, you need to commit the changes to Git:
--
cgit v1.2.3
From f785ad786ae49dd6f7a2f1d77c44ea17008c6656 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 8 Apr 2017 17:10:42 -0400
Subject: Add scaffolding for different sections in 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 48 ++++++++++++++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 5d4885d55c..d796236807 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -223,41 +223,89 @@ Railties
Please refer to the [Changelog][railties] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Action Pack
-----------
Please refer to the [Changelog][action-pack] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Action View
-------------
Please refer to the [Changelog][action-view] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Action Mailer
-------------
Please refer to the [Changelog][action-mailer] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Active Record
-------------
Please refer to the [Changelog][active-record] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Active Model
------------
Please refer to the [Changelog][active-model] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Active Job
-----------
Please refer to the [Changelog][active-job] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Active Support
--------------
Please refer to the [Changelog][active-support] for detailed changes.
+### Removals
+
+### Deprecations
+
+### Notable changes
+
Credits
-------
--
cgit v1.2.3
From 3b5a6dfb18f33c373a89760c60d741f34206f23b Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 8 Apr 2017 20:52:07 -0400
Subject: Add text to "Upgrading to Rails 5.1"
[ci skip]
---
guides/source/5_1_release_notes.md | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index d796236807..e995c50297 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -24,7 +24,14 @@ repository on GitHub.
Upgrading to Rails 5.1
----------------------
-ToDo
+If you're upgrading an existing application, it's a great idea to have good test
+coverage before going in. You should also first upgrade to Rails 5.0 in case you
+haven't and make sure your application still runs as expected before attempting
+an update to Rails 5.1. A list of things to watch out for when upgrading is
+available in the
+[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-5-0-to-rails-5-1)
+guide.
+
Major Features
--------------
--
cgit v1.2.3
From cad58fb413947142cc501d55ec6ab7099b3ff706 Mon Sep 17 00:00:00 2001
From: Prathamesh Sonpatki
Date: Mon, 27 Mar 2017 03:55:20 +0530
Subject: Started adding release notes for Rails 5.1 [ci skip]
---
guides/source/5_1_release_notes.md | 94 +++++++++++++++++++++++++++++---------
1 file changed, 72 insertions(+), 22 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index e995c50297..cf6158b6fa 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -228,90 +228,140 @@ can generate form tags based on URLs, scopes or models.
Railties
--------
+### Removals
+
+### Deprecations
+
+### Notable Changes
+
Please refer to the [Changelog][railties] for detailed changes.
+Action Cable
+-----------
+
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+* Added support for `channel_prefix` to Redis and evented Redis adapters
+ in `cable.yml` to avoid name collisions when using the same Redis server
+ with multiple applications.
+ ([Pull Request](https://github.com/rails/rails/pull/27425))
+
+Please refer to the [Changelog][action-cable] for detailed changes.
Action Pack
-----------
-Please refer to the [Changelog][action-pack] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+Please refer to the [Changelog][action-pack] for detailed changes.
Action View
-------------
-Please refer to the [Changelog][action-view] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+Please refer to the [Changelog][action-view] for detailed changes.
Action Mailer
-------------
-Please refer to the [Changelog][action-mailer] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+* Allowed setting custom content type when attachments are included
+ and body is set inline.
+ ([Pull Request](https://github.com/rails/rails/pull/27227))
+
+* Allowed passing lambdas as values to the `default` method.
+ ([Commit](https://github.com/rails/rails/commit/1cec84ad2ddd843484ed40b1eb7492063ce71baf))
+
+* Added support for parameterized invocation of mailers to share before filters and defaults
+ between different mailer actions.
+ ([Commit](https://github.com/rails/rails/commit/1cec84ad2ddd843484ed40b1eb7492063ce71baf))
+
+* Passed the incoming arguments to the mailer action to `process.action_mailer` event under
+ an `args` key.
+ ([Pull Request](https://github.com/rails/rails/pull/27900))
+
+Please refer to the [Changelog][action-mailer] for detailed changes.
Active Record
-------------
-Please refer to the [Changelog][active-record] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+* Skipped comments in the output of `mysqldump` command by default.
+ ([Pull Request](https://github.com/rails/rails/pull/23301))
+
+* Fixed `ActiveRecord::Relation#count` to use Ruby's `Enumerable#count` for counting
+ records when a block is passed as argument instead of silently ignoring the
+ passed block.
+ ([Pull Request](https://github.com/rails/rails/pull/24203))
+
+* Pass `"-v ON_ERROR_STOP=1"` flag with `psql` command to not suppress SQL errors.
+ ([Pull Request](https://github.com/rails/rails/pull/24773))
+
+Please refer to the [Changelog][active-record] for detailed changes.
Active Model
------------
-Please refer to the [Changelog][active-model] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+Please refer to the [Changelog][active-model] for detailed changes.
Active Job
-----------
-Please refer to the [Changelog][active-job] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+Please refer to the [Changelog][active-job] for detailed changes.
Active Support
--------------
-Please refer to the [Changelog][active-support] for detailed changes.
-
### Removals
### Deprecations
-### Notable changes
+### Notable Changes
+
+* Added `Module#delegate_missing_to` to delegate method calls not
+ defined for the current object to a proxy object.
+ ([Pull Request](https://github.com/rails/rails/pull/23930))
+
+* Added `Date#all_day` which returns a range representing the whole day
+ of the current date & time.
+ ([Pull Request](https://github.com/rails/rails/pull/24930))
+
+Please refer to the [Changelog][active-support] for detailed changes.
Credits
-------
--
cgit v1.2.3
From a1d16751064afdf9f66756e3b87c6c59246907bf Mon Sep 17 00:00:00 2001
From: vishalzambre
Date: Thu, 6 Apr 2017 13:02:52 +0530
Subject: [ci skip] documented issue related before_destroy
Updated text
---
guides/source/active_record_callbacks.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'guides')
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 77bd3c97e8..817c7cc835 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -117,6 +117,8 @@ Here is a list with all the available Active Record callbacks, listed in the sam
WARNING. `after_save` runs both on create and update, but always _after_ the more specific callbacks `after_create` and `after_update`, no matter the order in which the macro calls were executed.
+NOTE: `before_destroy` callback should be placed before `dependent: :destroy` associations (or use the `prepend: true` option), to ensure they execute before the records are deleted by `dependent: :destroy`.
+
### `after_initialize` and `after_find`
The `after_initialize` callback will be called whenever an Active Record object is instantiated, either by directly using `new` or when a record is loaded from the database. It can be useful to avoid the need to directly override your Active Record `initialize` method.
--
cgit v1.2.3
From 8801108c0f12827832a0082e17d2c087815fd99f Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Mon, 10 Apr 2017 10:44:18 -0400
Subject: Pluralize callback
Users could have more than one `before_destroy` callback in their models.
[ci skip]
---
guides/source/active_record_callbacks.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/active_record_callbacks.md b/guides/source/active_record_callbacks.md
index 1a2c967643..b1705855d0 100644
--- a/guides/source/active_record_callbacks.md
+++ b/guides/source/active_record_callbacks.md
@@ -117,7 +117,9 @@ Here is a list with all the available Active Record callbacks, listed in the sam
WARNING. `after_save` runs both on create and update, but always _after_ the more specific callbacks `after_create` and `after_update`, no matter the order in which the macro calls were executed.
-NOTE: `before_destroy` callback should be placed before `dependent: :destroy` associations (or use the `prepend: true` option), to ensure they execute before the records are deleted by `dependent: :destroy`.
+NOTE: `before_destroy` callbacks should be placed before `dependent: :destroy`
+associations (or use the `prepend: true` option), to ensure they execute before
+the records are deleted by `dependent: :destroy`.
### `after_initialize` and `after_find`
--
cgit v1.2.3
From 374dca2d66d474ba3434bd67e9a20e4388b2a83e Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Mon, 10 Apr 2017 11:04:38 -0400
Subject: Small grammar fixes
[ci skip]
---
guides/source/rails_on_rack.md | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index 340933c7ee..ed9c4bb72a 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -22,7 +22,9 @@ Rack provides a minimal, modular and adaptable interface for developing web appl
* [Rack API Documentation](http://rack.github.io/)
-Explaining Rack is not really in the scope of this guide. In case you are not familiar with Rack's basics, you should check out the [Resources](#resources) section below.
+Explaining how Rack works is not really in the scope of this guide. In case you
+are not familiar with Rack's basics, you should check out the [Resources](#resources)
+section below.
Rails on Rack
-------------
@@ -74,7 +76,7 @@ And start the server:
$ rackup config.ru
```
-To find out more about different `rackup` options:
+To find out more about different `rackup` options, you can run:
```bash
$ rackup --help
@@ -89,7 +91,8 @@ Action Dispatcher Middleware Stack
Many of Action Dispatcher's internal components are implemented as Rack middlewares. `Rails::Application` uses `ActionDispatch::MiddlewareStack` to combine various internal and external middlewares to form a complete Rails Rack application.
-NOTE: `ActionDispatch::MiddlewareStack` is Rails equivalent of `Rack::Builder`, but built for better flexibility and more features to meet Rails' requirements.
+NOTE: `ActionDispatch::MiddlewareStack` is Rails' equivalent of `Rack::Builder`,
+but is built for better flexibility and more features to meet Rails' requirements.
### Inspecting Middleware Stack
--
cgit v1.2.3
From c134a17b3d740ab1578cdd8da8aba3909910feb2 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Mon, 10 Apr 2017 11:05:05 -0400
Subject: Remove link to rack.github.io
We mention the "resources" section of the guide in the next paragraph,
and the link is listed there. IMHO we shouldn't list it twice.
[ci skip]
---
guides/source/rails_on_rack.md | 2 --
1 file changed, 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/rails_on_rack.md b/guides/source/rails_on_rack.md
index ed9c4bb72a..f25b185fb5 100644
--- a/guides/source/rails_on_rack.md
+++ b/guides/source/rails_on_rack.md
@@ -20,8 +20,6 @@ Introduction to Rack
Rack provides a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.
-* [Rack API Documentation](http://rack.github.io/)
-
Explaining how Rack works is not really in the scope of this guide. In case you
are not familiar with Rack's basics, you should check out the [Resources](#resources)
section below.
--
cgit v1.2.3
From 8ca42638bc3115e5161b084a668e253dee94fd24 Mon Sep 17 00:00:00 2001
From: Julian Nadeau
Date: Mon, 13 Mar 2017 17:37:54 -0400
Subject: Add Documentation for Active Support On Load Hooks
---
guides/source/engines.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 112 insertions(+)
(limited to 'guides')
diff --git a/guides/source/engines.md b/guides/source/engines.md
index 180a786237..c7aedd2987 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -14,6 +14,7 @@ After reading this guide, you will know:
* How to build features for the engine.
* How to hook the engine into an application.
* How to override engine functionality in the application.
+* Avoid loading Rails frameworks with Load and Configuration Hooks
--------------------------------------------------------------------------------
@@ -1410,3 +1411,114 @@ module MyEngine
end
end
```
+
+Active Support On Load Hooks
+----------------------------
+
+Active Support is the Ruby on Rails component responsible for providing Ruby language extensions, utilities, and other transversal utilities.
+
+Rails code can often be referenced on load of an application. Rails is responsible for the load order of these frameworks, so when you load frameworks, such as `ActiveRecord::Base`, prematurely you are violating an implicit contract your application has with Rails. Moreover, by loading code such as `ActiveRecord::Base` on boot of your application you are loading entire frameworks which may slow down your boot time and could cause conflicts with load order and boot of your application.
+
+On Load hooks are the API that allow you to hook into this initialization process without violating the load contract with Rails. This will also mitigate boot performance degradation and avoid conflicts.
+
+## What are `on_load` hooks?
+
+Since Ruby is a dynamic language, some code will cause different Rails frameworks to load. Take this snippet for instance:
+
+```ruby
+ActiveRecord::Base.include(MyActiveRecordHelper)
+```
+
+This snippet means that when this file is loaded, it will encounter `ActiveRecord::Base`. This encounter causes Ruby to look for the definition of that constant and will require it. This causes the entire Active Record framework to be loaded on boot.
+
+`ActiveSupport.on_load` is a mechanism that can be used to defer the loading of code until it is actually needed. The snippet above can be changed to:
+
+```ruby
+ActiveSupport.on_load(:active_record) { include MyActiveRecordHelper }
+```
+
+This new snippet will only include `MyActiveRecordHelper` when `ActiveRecord::Base` is loaded.
+
+## How does it work?
+
+In the Rails framework these hooks are called when a specific library is loaded. For example, when `ActionController::Base` is loaded, the `:action_controller_base` hook is called. This means that all `ActiveSupport.on_load` calls with `:action_controller_base` hooks will be called in the context of `ActionController::Base` (that means `self` will be an `ActionController::Base`).
+
+## Modifying code to use `on_load` hooks
+
+Modifying code is generally straightforward. If you have a line of code that refers to a Rails framework such as `ActiveRecord::Base` you can wrap that code in an `on_load` hook.
+
+### Example 1
+
+```ruby
+ActiveRecord::Base.include(MyActiveRecordHelper)
+```
+
+becomes
+
+```ruby
+ActiveSupport.on_load(:active_record) { include MyActiveRecordHelper } # self refers to ActiveRecord::Base here, so we can simply #include
+```
+
+### Example 2
+
+```ruby
+ActionController::Base.prepend(MyActionControllerHelper)
+```
+
+becomes
+
+```ruby
+ActiveSupport.on_load(:action_controller_base) { prepend MyActionControllerHelper } # self refers to ActionController::Base here, so we can simply #prepend
+```
+
+### Example 3
+
+```ruby
+ActiveRecord::Base.include_root_in_json = true
+```
+
+becomes
+
+```ruby
+ActiveSupport.on_load(:active_record) { self.include_root_in_json = true } # self refers to ActiveRecord::Base here
+```
+
+## Available Hooks
+
+These are the hooks you can use in your own code.
+
+To hook into the initialization process of one of the following classes use the available hook.
+
+| Class | Available Hooks |
+| --------------------------------- | ------------------------------------ |
+| `ActionCable` | `action_cable` |
+| `ActionController::API` | `action_controller_api` |
+| `ActionController::API` | `action_controller` |
+| `ActionController::Base` | `action_controller_base` |
+| `ActionController::Base` | `action_controller` |
+| `ActionController::TestCase` | `action_controller_test_case` |
+| `ActionDispatch::IntegrationTest` | `action_dispatch_integration_test` |
+| `ActionMailer::Base` | `action_mailer` |
+| `ActionMailer::TestCase` | `action_mailer_test_case` |
+| `ActionView::Base` | `action_view` |
+| `ActionView::TestCase` | `action_view_test_case` |
+| `ActiveJob::Base` | `active_job` |
+| `ActiveJob::TestCase` | `active_job_test_case` |
+| `ActiveRecord::Base` | `active_record` |
+| `ActiveSupport::TestCase` | `active_support_test_case` |
+| `i18n` | `i18n` |
+
+## Configuration hooks
+
+These are the available configuration hooks. They do not hook into any particular framework, instead they run in context of the entire application.
+
+| Hook | Use Case |
+| ---------------------- | ------------------------------------------------------------------------------------- |
+| `before_configuration` | First configurable block to run. Called before any initializers are run. |
+| `before_initialize` | Second configurable block to run. Called before frameworks initialize. |
+| `before_eager_load` | Third configurable block to run. Does not run if `config.cache_classes` set to false. |
+| `after_initialize` | Last configurable block to run. Called after frameworks initialize. |
+
+### Example
+
+`config.before_configuration { puts 'I am called before any initializers' }`
--
cgit v1.2.3
From 04b9d6829723b5c6c7854e9c992f63aada0d72bb Mon Sep 17 00:00:00 2001
From: Dzianis Dashkevich
Date: Tue, 11 Apr 2017 18:50:05 +0300
Subject: Update routing doc on the `get` `to:` option [ci skip]
---
guides/source/routing.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/routing.md b/guides/source/routing.md
index 545f53a8e0..f7dbbc510e 100644
--- a/guides/source/routing.md
+++ b/guides/source/routing.md
@@ -142,10 +142,10 @@ Sometimes, you have a resource that clients always look up without referencing a
get 'profile', to: 'users#show'
```
-Passing a `String` to `get` will expect a `controller#action` format, while passing a `Symbol` will map directly to an action but you must also specify the `controller:` to use:
+Passing a `String` to `to:` will expect a `controller#action` format. When using a `Symbol`, the `to:` option should be replaced with `action:`. When using a `String` without a `#`, the `to:` option should be replaced with `controller:`:
```ruby
-get 'profile', to: :show, controller: 'users'
+get 'profile', action: :show, controller: 'users'
```
This resourceful route:
--
cgit v1.2.3
From d4692c92c306184a5f96fff4b38f52e1fc3ee395 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
Date: Tue, 11 Apr 2017 18:48:53 -0400
Subject: :scissors:
[ci skip]
---
guides/source/engines.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/engines.md b/guides/source/engines.md
index c7aedd2987..2276f348a1 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -1417,7 +1417,7 @@ Active Support On Load Hooks
Active Support is the Ruby on Rails component responsible for providing Ruby language extensions, utilities, and other transversal utilities.
-Rails code can often be referenced on load of an application. Rails is responsible for the load order of these frameworks, so when you load frameworks, such as `ActiveRecord::Base`, prematurely you are violating an implicit contract your application has with Rails. Moreover, by loading code such as `ActiveRecord::Base` on boot of your application you are loading entire frameworks which may slow down your boot time and could cause conflicts with load order and boot of your application.
+Rails code can often be referenced on load of an application. Rails is responsible for the load order of these frameworks, so when you load frameworks, such as `ActiveRecord::Base`, prematurely you are violating an implicit contract your application has with Rails. Moreover, by loading code such as `ActiveRecord::Base` on boot of your application you are loading entire frameworks which may slow down your boot time and could cause conflicts with load order and boot of your application.
On Load hooks are the API that allow you to hook into this initialization process without violating the load contract with Rails. This will also mitigate boot performance degradation and avoid conflicts.
--
cgit v1.2.3
From 066e5d62d5e83830040083b5f34c9da8bed0ba4f Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sat, 15 Apr 2017 14:22:01 -0400
Subject: Revert parts of cad58fb
Changelog links at the top of the components, and lowercased the 'c' in
notable changes. Personally, the styling isn't super important to me, but
it's what we always done in previous guides, so I figured it's better to
keep with what we've always done.
[ci skip]
---
guides/source/5_1_release_notes.md | 54 +++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 27 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index cf6158b6fa..43b5a0fdaf 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -228,60 +228,62 @@ can generate form tags based on URLs, scopes or models.
Railties
--------
+Please refer to the [Changelog][railties] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
-
-Please refer to the [Changelog][railties] for detailed changes.
+### Notable changes
Action Cable
-----------
+Please refer to the [Changelog][action-cable] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
+### Notable changes
* Added support for `channel_prefix` to Redis and evented Redis adapters
in `cable.yml` to avoid name collisions when using the same Redis server
with multiple applications.
([Pull Request](https://github.com/rails/rails/pull/27425))
-Please refer to the [Changelog][action-cable] for detailed changes.
-
Action Pack
-----------
+Please refer to the [Changelog][action-pack] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
-
-Please refer to the [Changelog][action-pack] for detailed changes.
+### Notable changes
Action View
-------------
+Please refer to the [Changelog][action-view] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
-
-Please refer to the [Changelog][action-view] for detailed changes.
+### Notable changes
Action Mailer
-------------
+Please refer to the [Changelog][action-mailer] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
+### Notable changes
* Allowed setting custom content type when attachments are included
and body is set inline.
@@ -298,16 +300,16 @@ Action Mailer
an `args` key.
([Pull Request](https://github.com/rails/rails/pull/27900))
-Please refer to the [Changelog][action-mailer] for detailed changes.
-
Active Record
-------------
+Please refer to the [Changelog][active-record] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
+### Notable changes
* Skipped comments in the output of `mysqldump` command by default.
([Pull Request](https://github.com/rails/rails/pull/23301))
@@ -320,38 +322,38 @@ Active Record
* Pass `"-v ON_ERROR_STOP=1"` flag with `psql` command to not suppress SQL errors.
([Pull Request](https://github.com/rails/rails/pull/24773))
-Please refer to the [Changelog][active-record] for detailed changes.
-
Active Model
------------
+Please refer to the [Changelog][active-model] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
-
-Please refer to the [Changelog][active-model] for detailed changes.
+### Notable changes
Active Job
-----------
+Please refer to the [Changelog][active-job] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
-
-Please refer to the [Changelog][active-job] for detailed changes.
+### Notable changes
Active Support
--------------
+Please refer to the [Changelog][active-support] for detailed changes.
+
### Removals
### Deprecations
-### Notable Changes
+### Notable changes
* Added `Module#delegate_missing_to` to delegate method calls not
defined for the current object to a proxy object.
@@ -361,8 +363,6 @@ Active Support
of the current date & time.
([Pull Request](https://github.com/rails/rails/pull/24930))
-Please refer to the [Changelog][active-support] for detailed changes.
-
Credits
-------
--
cgit v1.2.3
From 908afa7d18fe54c7b7b6d4fcd48eaeb29362a432 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 16 Apr 2017 22:24:38 -0400
Subject: Small grammar fixes
[ci skip]
---
guides/source/working_with_javascript_in_rails.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index cbaf9100f7..dacd7b71e8 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -338,7 +338,7 @@ this:
end
```
-Notice the format.js in the `respond_to` block; that allows the controller to
+Notice the `format.js` in the `respond_to` block: that allows the controller to
respond to your Ajax request. You then have a corresponding
`app/views/users/create.js.erb` view file that generates the actual JavaScript
code that will be sent and executed on the client side.
@@ -355,7 +355,7 @@ which uses Ajax to speed up page rendering in most applications.
### How Turbolinks Works
-Turbolinks attaches a click handler to all `` on the page. If your browser
+Turbolinks attaches a click handler to all `` tags on the page. If your browser
supports
[PushState](https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Manipulating_the_browser_history#The_pushState%28%29_method),
Turbolinks will make an Ajax request for the page, parse the response, and
--
cgit v1.2.3
From bfa1ece75061e04d7abb79bbdd2a7581b7ce2b94 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 16 Apr 2017 22:25:23 -0400
Subject: Small grammar fix
[ci skip]
---
guides/source/working_with_javascript_in_rails.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md
index dacd7b71e8..2a6a87c232 100644
--- a/guides/source/working_with_javascript_in_rails.md
+++ b/guides/source/working_with_javascript_in_rails.md
@@ -385,7 +385,7 @@ $(document).ready ->
```
However, because Turbolinks overrides the normal page loading process, the
-event that this relies on will not be fired. If you have code that looks like
+event that this relies upon will not be fired. If you have code that looks like
this, you must change your code to do this instead:
```coffeescript
--
cgit v1.2.3
From 767f29e181bdbbec2f96bb09822924eea18c2e9f Mon Sep 17 00:00:00 2001
From: Eric Henziger
Date: Mon, 17 Apr 2017 12:01:34 +0200
Subject: Add missing word 'to' [ci skip]
While the original sentence is easy to understand, adding the 'to' is
imho a bit more correct.
Sources:
* https://ell.stackexchange.com/q/16964
* https://www.usingenglish.com/forum/threads/127099-It-is-referred-as-or-It-is-referred-to-as
---
guides/source/generators.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/generators.md b/guides/source/generators.md
index d0b6cef3fd..a554e08204 100644
--- a/guides/source/generators.md
+++ b/guides/source/generators.md
@@ -426,7 +426,7 @@ Fallbacks allow your generators to have a single responsibility, increasing code
Application Templates
---------------------
-Now that you've seen how generators can be used _inside_ an application, did you know they can also be used to _generate_ applications too? This kind of generator is referred as a "template". This is a brief overview of the Templates API. For detailed documentation see the [Rails Application Templates guide](rails_application_templates.html).
+Now that you've seen how generators can be used _inside_ an application, did you know they can also be used to _generate_ applications too? This kind of generator is referred to as a "template". This is a brief overview of the Templates API. For detailed documentation see the [Rails Application Templates guide](rails_application_templates.html).
```ruby
gem "rspec-rails", group: "test"
--
cgit v1.2.3
From 0963aab728ab854bb6e45889cd45054b25a0cd4b Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Mon, 17 Apr 2017 21:53:06 -0400
Subject: Small docs fix
Add missing word "programming", to clarify what type of language Ruby is
;)
[ci skip]
---
guides/source/getting_started.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 068114898d..18331bb73b 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -46,7 +46,7 @@ development with Rails.
What is Rails?
--------------
-Rails is a web application development framework written in the Ruby language.
+Rails is a web application development framework written in the Ruby programming language.
It is designed to make programming web applications easier by making assumptions
about what every developer needs to get started. It allows you to write less
code while accomplishing more than many other languages and frameworks.
--
cgit v1.2.3
From 2b82e96597d4d9a6054bdeea86e51477565ac449 Mon Sep 17 00:00:00 2001
From: "yuuji.yaginuma"
Date: Wed, 19 Apr 2017 08:02:32 +0900
Subject: Remove datetime fields from helper list [ci skip]
The `datetime_field` is an alias of the `datetime_local_field`, there is
no helper to generate datetime fields.
Ref: #25469
---
guides/source/form_helpers.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/form_helpers.md b/guides/source/form_helpers.md
index 0508b0fb38..ba6e158ba1 100644
--- a/guides/source/form_helpers.md
+++ b/guides/source/form_helpers.md
@@ -164,7 +164,7 @@ make it easier for users to click the inputs.
Other form controls worth mentioning are textareas, password fields,
hidden fields, search fields, telephone fields, date fields, time fields,
-color fields, datetime fields, datetime-local fields, month fields, week fields,
+color fields, datetime-local fields, month fields, week fields,
URL fields, email fields, number fields and range fields:
```erb
--
cgit v1.2.3
From e2648c42abe7466e2c982db6c5fd4565a0555562 Mon Sep 17 00:00:00 2001
From: vishalzambre
Date: Wed, 19 Apr 2017 11:31:00 +0530
Subject: [ci skip] Changed plain text to NOTE.
---
guides/source/active_record_migrations.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_record_migrations.md b/guides/source/active_record_migrations.md
index 6e7e29ed60..75e1096426 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -972,11 +972,11 @@ on. Because this is database-independent, it could be loaded into any database
that Active Record supports. This could be very useful if you were to
distribute an application that is able to run against multiple databases.
-There is however a trade-off: `db/schema.rb` cannot express database specific
-items such as triggers, stored procedures or check constraints. While in a
-migration you can execute custom SQL statements, the schema dumper cannot
-reconstitute those statements from the database. If you are using features like
-this, then you should set the schema format to `:sql`.
+NOTE: `db/schema.rb` cannot express database specific items such as triggers,
+sequences, stored procedures or check constraints, etc. While in a migration you
+can execute custom SQL statements, the schema dumper cannot reconstitute those
+statements from the database. If you are using features like this, then you
+should set the schema format to `:sql`.
Instead of using Active Record's schema dumper, the database's structure will
be dumped using a tool specific to the database (via the `db:structure:dump`
--
cgit v1.2.3
From 54fa07f2c87a7aad9a17539e409497e46d2607cd Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Wed, 19 Apr 2017 15:40:25 -0400
Subject: Reword sentence
Sentence had some awkward grammar and was kind of confusing, tried to make it easier
to understand what it was trying to say :)
[ci skip]
---
guides/source/active_record_migrations.md | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'guides')
diff --git a/guides/source/active_record_migrations.md b/guides/source/active_record_migrations.md
index 75e1096426..7fdb5901f3 100644
--- a/guides/source/active_record_migrations.md
+++ b/guides/source/active_record_migrations.md
@@ -973,9 +973,9 @@ that Active Record supports. This could be very useful if you were to
distribute an application that is able to run against multiple databases.
NOTE: `db/schema.rb` cannot express database specific items such as triggers,
-sequences, stored procedures or check constraints, etc. While in a migration you
-can execute custom SQL statements, the schema dumper cannot reconstitute those
-statements from the database. If you are using features like this, then you
+sequences, stored procedures or check constraints, etc. Please note that while
+custom SQL statements can be run in migrations, these statements cannot be reconstituted
+by the schema dumper. If you are using features like this, then you
should set the schema format to `:sql`.
Instead of using Active Record's schema dumper, the database's structure will
--
cgit v1.2.3
From 0871e5e5c1e6151a7ed3bdf7b22209ac11532b31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
Date: Wed, 19 Apr 2017 20:02:03 -0400
Subject: Fix all style guides violations
Closes #28382
Closes #28651
---
guides/Rakefile | 6 +++---
guides/rails_guides/markdown.rb | 2 +-
guides/rails_guides/markdown/renderer.rb | 18 +++++++++---------
3 files changed, 13 insertions(+), 13 deletions(-)
(limited to 'guides')
diff --git a/guides/Rakefile b/guides/Rakefile
index 0a591558e1..3a6f10040f 100644
--- a/guides/Rakefile
+++ b/guides/Rakefile
@@ -17,13 +17,13 @@ namespace :guides do
namespace :generate do
desc "Generate HTML guides"
- task :html => :encoding do
+ task html: :encoding do
ENV["WARNINGS"] = "1" # authors can't disable this
ruby "rails_guides.rb"
end
desc "Generate .mobi file. The kindlegen executable must be in your PATH. You can get it for free from http://www.amazon.com/gp/feature.html?docId=1000765211"
- task :kindle => :encoding do
+ task kindle: :encoding do
require "kindlerb"
unless Kindlerb.kindlegen_available?
abort "Please run `setupkindlerb` to install kindlegen"
@@ -38,7 +38,7 @@ namespace :guides do
# Validate guides -------------------------------------------------------------------------
desc 'Validate guides, use ONLY=foo to process just "foo.html"'
- task :validate => :encoding do
+ task validate: :encoding do
ruby "w3c_validator.rb"
end
diff --git a/guides/rails_guides/markdown.rb b/guides/rails_guides/markdown.rb
index 16aaa7d1eb..02d58601c4 100644
--- a/guides/rails_guides/markdown.rb
+++ b/guides/rails_guides/markdown.rb
@@ -106,7 +106,7 @@ module RailsGuides
end
end
- doc.css('h3, h4, h5, h6').each do |node|
+ doc.css("h3, h4, h5, h6").each do |node|
node.inner_html = "#{node.inner_html}"
end
end.to_html
diff --git a/guides/rails_guides/markdown/renderer.rb b/guides/rails_guides/markdown/renderer.rb
index 20cbd568c9..9d43c10be6 100644
--- a/guides/rails_guides/markdown/renderer.rb
+++ b/guides/rails_guides/markdown/renderer.rb
@@ -94,15 +94,15 @@ HTML
tree = version || edge
root = file_path[%r{(.+)/}, 1]
- path = case root
- when "abstract_controller", "action_controller", "action_dispatch"
- "actionpack/lib/#{file_path}"
- when /\A(action|active)_/
- "#{root.sub("_", "")}/lib/#{file_path}"
- else
- file_path
- end
-
+ path = \
+ case root
+ when "abstract_controller", "action_controller", "action_dispatch"
+ "actionpack/lib/#{file_path}"
+ when /\A(action|active)_/
+ "#{root.sub("_", "")}/lib/#{file_path}"
+ else
+ file_path
+ end
"https://github.com/rails/rails/tree/#{tree}/#{path}"
end
--
cgit v1.2.3
From 0541a0d5481043a9c78371446389794944daf3f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?=
Date: Fri, 21 Apr 2017 16:40:03 -0400
Subject: Add note about #26929 in the upgrade guide
This is a small breaking change that we chose to make in 5.1 since the
fix can be done with a search and replace tool.
---
guides/source/upgrading_ruby_on_rails.md | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
(limited to 'guides')
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 3afc0e5309..ebfdc78dfc 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -84,6 +84,23 @@ Also, if you have pretty old YAML documents containing dumps of such objects,
you may need to load and dump them again to make sure that they reference
the right constant and that loading them won't break in the future.
+### `config.secrets` now load with all keys as symbols
+
+If you application stores nested configuration in `secrets.yml` now all keys are being
+laded as symbols so access using strings should be changed.
+
+From:
+
+```ruby
+Rails.appplication.config.secrets[:smtp_settings]["address"]
+```
+
+To:
+
+```ruby
+Rails.application.config.secrets[:smtp_settings][:address]
+```
+
Upgrading from Rails 4.2 to Rails 5.0
-------------------------------------
--
cgit v1.2.3
From 93897d79edfb5b546bf544a27b92f66882ca1b88 Mon Sep 17 00:00:00 2001
From: Shanthi Pendleton
Date: Sun, 23 Apr 2017 13:28:38 +0100
Subject: [ci_skip] Fix typo in Rails 5.1 upgrade notes
---
guides/source/upgrading_ruby_on_rails.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index ebfdc78dfc..3284a6c77e 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -87,7 +87,7 @@ the right constant and that loading them won't break in the future.
### `config.secrets` now load with all keys as symbols
If you application stores nested configuration in `secrets.yml` now all keys are being
-laded as symbols so access using strings should be changed.
+loaded as symbols so access using strings should be changed.
From:
--
cgit v1.2.3
From 31f27aa25806670545a7d17f5c6a04d0acd27beb Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 10:35:36 -0400
Subject: Add Active Job info to 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 43b5a0fdaf..f9062920f0 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -340,10 +340,21 @@ Please refer to the [Changelog][active-job] for detailed changes.
### Removals
-### Deprecations
+* Removed deprecated support to passing the adapter class to `.queue_adapter`.
+ ([commit](https://github.com/rails/rails/commit/d1fc0a5eb286600abf8505516897b96c2f1ef3f6))
+
+* Removed deprecated `#original_exception` in `ActiveJob::DeserializationError`.
+ ([commit](https://github.com/rails/rails/commit/d861a1fcf8401a173876489d8cee1ede1cecde3b))
### Notable changes
+* Added declarative exception handling via `ActiveJob::Base.retry_on` and `ActiveJob::Base.discard_on`.
+ ([Pull Request](https://github.com/rails/rails/pull/25991))
+
+* Yield the job instance so you have access to things like `job.arguments` on
+ the custom logic after retries fail.
+ ([commit](https://github.com/rails/rails/commit/a1e4c197cb12fef66530a2edfaeda75566088d1f))
+
Active Support
--------------
--
cgit v1.2.3
From 3ec76256e88d36e251c388921d0fd172e86fa297 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 10:39:30 -0400
Subject: Finish Action Mailer section in release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index f9062920f0..6c9b519605 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -279,12 +279,12 @@ Action Mailer
Please refer to the [Changelog][action-mailer] for detailed changes.
-### Removals
-
-### Deprecations
-
### Notable changes
+* Exception handling: use `rescue_from` to handle exceptions raised by
+ mailer actions, by message delivery, and by deferred delivery jobs.
+ ([commit](https://github.com/rails/rails/commit/e35b98e6f5c54330245645f2ed40d56c74538902))
+
* Allowed setting custom content type when attachments are included
and body is set inline.
([Pull Request](https://github.com/rails/rails/pull/27227))
--
cgit v1.2.3
From 334d4cd3c75966a44239c7f31507fc1b4ecd1c85 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 10:48:41 -0400
Subject: Finish Action Cable section in release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 6 ++++++
1 file changed, 6 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 6c9b519605..27a7a748bd 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -252,6 +252,12 @@ Please refer to the [Changelog][action-cable] for detailed changes.
with multiple applications.
([Pull Request](https://github.com/rails/rails/pull/27425))
+* Permit same-origin connections by default.
+ ([commit](https://github.com/rails/rails/commit/dae404473409fcab0e07976aec626df670e52282))
+
+* Add `ActiveSupport::Notifications` hook for broadcasing data.
+ ([Pull Request](https://github.com/rails/rails/pull/24988))
+
Action Pack
-----------
--
cgit v1.2.3
From 13eb67309ef31f2b61b74639ae8234adee3b9eac Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 10:49:19 -0400
Subject: Remove unused headings
[ci skip]
---
guides/source/5_1_release_notes.md | 4 ----
1 file changed, 4 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 27a7a748bd..371ef73c4b 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -241,10 +241,6 @@ Action Cable
Please refer to the [Changelog][action-cable] for detailed changes.
-### Removals
-
-### Deprecations
-
### Notable changes
* Added support for `channel_prefix` to Redis and evented Redis adapters
--
cgit v1.2.3
From 87367703b35bddf9b63cc96ced90a75e214e5a77 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 10:57:51 -0400
Subject: Add Active Model info to 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 371ef73c4b..1bfb6491f3 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -331,10 +331,21 @@ Please refer to the [Changelog][active-model] for detailed changes.
### Removals
-### Deprecations
+* Removed deprecated methods in `ActiveModel::Errors`.
+ ([commit](https://github.com/rails/rails/commit/9de6457ab0767ebab7f2c8bc583420fda072e2bd))
+
+* Removed deprecated `:tokenizer` option in the length validator.
+ ([commit](https://github.com/rails/rails/commit/6a78e0ecd6122a6b1be9a95e6c4e21e10e429513))
+
+* Remove deprecated behavior that halts callbacks when the return value is false.
+ ([commit](https://github.com/rails/rails/commit/3a25cdca3e0d29ee2040931d0cb6c275d612dffe))
### Notable changes
+* The original string assigned to a model attribute is no longer incorrectly
+ frozen.
+ ([Pull Request](https://github.com/rails/rails/pull/28729))
+
Active Job
-----------
--
cgit v1.2.3
From ee9f97de94fef19550da3006f36e5090d138cdbc Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 11:10:24 -0400
Subject: Add Railties info to 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 1bfb6491f3..be978295e2 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -232,10 +232,46 @@ Please refer to the [Changelog][railties] for detailed changes.
### Removals
+* Remove deprecated `config.static_cache_control`.
+ ([commit](https://github.com/rails/rails/commit/c861decd44198f8d7d774ee6a74194d1ac1a5a13)
+
+* Remove deprecated `config.serve_static_files`.
+ ([commit](https://github.com/rails/rails/commit/0129ca2eeb6d5b2ea8c6e6be38eeb770fe45f1fa))
+
+* Remove deprecated file `rails/rack/debugger`.
+ ([commit](https://github.com/rails/rails/commit/7563bf7b46e6f04e160d664e284a33052f9804b8))
+
+* Remove deprecated tasks: `rails:update`, `rails:template`, `rails:template:copy`,
+ `rails:update:configs` and `rails:update:bin`.
+ ([commit](https://github.com/rails/rails/commit/f7782812f7e727178e4a743aa2874c078b722eef))
+
+* Remove deprecated `CONTROLLER` environment variable for `routes` task.
+ ([commit](https://github.com/rails/rails/commit/f9ed83321ac1d1902578a0aacdfe55d3db754219))
+
+* Remove -j (--javascript) option from `rails new` command.
+ ([Pull Request](https://github.com/rails/rails/pull/28546))
+
### Deprecations
### Notable changes
+* The config file `secrets.yml` is now loaded in with all keys as symbols.
+ ([Pull Request](https://github.com/rails/rails/pull/26929))
+
+* Removed jquery-rails from default stack. rails-ujs, which is shipped
+ with Action View, is included as default UJS adapter.
+ ([Pull Request](https://github.com/rails/rails/pull/27113))
+
+* Add Yarn support in new apps with a yarn binstub and package.json.
+ ([Pull Request](https://github.com/rails/rails/pull/26836))
+
+* Add Webpack support in new apps via the --webpack option, which will delegate
+ to the rails/webpacker gem.
+ ([Pull Request](https://github.com/rails/rails/pull/27288))
+
+* Add encrypted secrets in `config/secrets.yml.enc`.
+ ([Pull Request](https://github.com/rails/rails/pull/28038))
+
Action Cable
-----------
--
cgit v1.2.3
From 3be448a3ba06cedd9edcfc33da92a7f94004efd1 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 11:14:35 -0400
Subject: Add more Railties notable changes
[ci skip]
---
guides/source/5_1_release_notes.md | 8 ++++++++
1 file changed, 8 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index be978295e2..cb01c6d6df 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -255,6 +255,10 @@ Please refer to the [Changelog][railties] for detailed changes.
### Notable changes
+* Added a shared section to `config/secrets.yml` that will be loaded for all
+ environments.
+ ([commit](https://github.com/rails/rails/commit/e530534265d2c32b5c5f772e81cb9002dcf5e9cf))
+
* The config file `secrets.yml` is now loaded in with all keys as symbols.
([Pull Request](https://github.com/rails/rails/pull/26929))
@@ -269,6 +273,10 @@ Please refer to the [Changelog][railties] for detailed changes.
to the rails/webpacker gem.
([Pull Request](https://github.com/rails/rails/pull/27288))
+* Initialize Git repo when generating new app, if option `--skip-git` is not
+ provided.
+ ([Pull Request](https://github.com/rails/rails/pull/27632))
+
* Add encrypted secrets in `config/secrets.yml.enc`.
([Pull Request](https://github.com/rails/rails/pull/28038))
--
cgit v1.2.3
From fd7ed5c07db51f5d7053d5c831186ed8c212d831 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 11:15:31 -0400
Subject: Remove unused heading
[ci skip]
---
guides/source/5_1_release_notes.md | 2 --
1 file changed, 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index cb01c6d6df..ed6802e457 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -251,8 +251,6 @@ Please refer to the [Changelog][railties] for detailed changes.
* Remove -j (--javascript) option from `rails new` command.
([Pull Request](https://github.com/rails/rails/pull/28546))
-### Deprecations
-
### Notable changes
* Added a shared section to `config/secrets.yml` that will be loaded for all
--
cgit v1.2.3
From c9d7eeb9dbca7b1cae877d1a02832861dce6691e Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 12:24:05 -0400
Subject: Small grammar fixes
[ci skip]
---
guides/source/upgrading_ruby_on_rails.md | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
(limited to 'guides')
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index 3284a6c77e..ff747a95a0 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -73,21 +73,20 @@ For more information on changes made to Rails 5.1 please see the [release notes]
### Top-level `HashWithIndifferentAccess` is soft-deprecated
If your application uses the the top-level `HashWithIndifferentAccess` class, you
-should slowly move your code to use the `ActiveSupport::HashWithIndifferentAccess`
-one.
+should slowly move your code to instead use `ActiveSupport::HashWithIndifferentAccess`.
It is only soft-deprecated, which means that your code will not break at the
-moment and no deprecation warning will be displayed but this constant will be
+moment and no deprecation warning will be displayed, but this constant will be
removed in the future.
Also, if you have pretty old YAML documents containing dumps of such objects,
you may need to load and dump them again to make sure that they reference
-the right constant and that loading them won't break in the future.
+the right constant, and that loading them won't break in the future.
-### `config.secrets` now load with all keys as symbols
+### `config.secrets` now loaded with all keys as symbols
-If you application stores nested configuration in `secrets.yml` now all keys are being
-loaded as symbols so access using strings should be changed.
+If your application stores nested configuration in `config/secrets.yml`, all keys
+are now loaded as symbols, so access using strings should be changed.
From:
--
cgit v1.2.3
From 295b2025d8eddbc7fbfbfceac0ea4f90fe34da69 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 12:28:14 -0400
Subject: Use parameters, not params
Reads better to use the full word.
[ci skip]
---
guides/source/5_1_release_notes.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index ed6802e457..a37e2b01ad 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -101,8 +101,8 @@ Secrets will be decrypted in production, using a key stored either in the
[Pull Request](https://github.com/rails/rails/pull/27825)
-Allows specifying common params used for all methods in a mailer class
-to share instance variables, headers and other common setup.
+Allows specifying common parameters used for all methods in a mailer class in
+order to share instance variables, headers and other common setup.
``` ruby
class InvitationsMailer < ApplicationMailer
--
cgit v1.2.3
From 269e11598ce09a61a9ccbb0ec81eed9424610283 Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 12:48:07 -0400
Subject: Add Action View info to 5.1 release notes
[ci skip]
---
guides/source/5_1_release_notes.md | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index a37e2b01ad..9a810368b1 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -314,10 +314,33 @@ Please refer to the [Changelog][action-view] for detailed changes.
### Removals
+* Removed deprecated `#original_exception` in `ActionView::Template::Error`.
+ ([commit](https://github.com/rails/rails/commit/b9ba263e5aaa151808df058f5babfed016a1879f))
+
+* Remove the option `encode_special_chars` misnomer from `strip_tags`.
+ ([Pull Request](https://github.com/rails/rails/pull/28061))
+
### Deprecations
+* Deprecated Erubis ERB handler in favor of Erubi.
+ ([Pull Request](https://github.com/rails/rails/pull/27757))
+
### Notable changes
+* Raw template handler (the default template handler in Rails 5) now outputs
+ HTML-safe strings.
+ ([commit](https://github.com/rails/rails/commit/1de0df86695f8fa2eeae6b8b46f9b53decfa6ec8))
+
+* Change `datetime_field` and `datetime_field_tag` to generate `datetime-local`
+ fields.
+ ([Pull Request](https://github.com/rails/rails/pull/28061))
+
+* New Builder-style syntax for HTML tags (`tag.div`, `tag.br`, etc.)
+ ([Pull Request](https://github.com/rails/rails/pull/25543))
+
+* Add `form_with` to unify `form_tag` and `form_for` usage.
+ ([Pull Request](https://github.com/rails/rails/pull/26976))
+
Action Mailer
-------------
--
cgit v1.2.3
From 0dd40fe72cfcf53b475a4084d61e9e931417c29e Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Sun, 23 Apr 2017 13:03:01 -0400
Subject: secrets.yml --> config/secrets.yml
[ci skip]
---
guides/source/5_1_release_notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 9a810368b1..ffa18f1a2b 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -257,7 +257,7 @@ Please refer to the [Changelog][railties] for detailed changes.
environments.
([commit](https://github.com/rails/rails/commit/e530534265d2c32b5c5f772e81cb9002dcf5e9cf))
-* The config file `secrets.yml` is now loaded in with all keys as symbols.
+* The config file `config/secrets.yml` is now loaded in with all keys as symbols.
([Pull Request](https://github.com/rails/rails/pull/26929))
* Removed jquery-rails from default stack. rails-ujs, which is shipped
--
cgit v1.2.3
From 247dace670d3f29a435b43e03a38816371090f6b Mon Sep 17 00:00:00 2001
From: "yuuji.yaginuma"
Date: Tue, 25 Apr 2017 07:34:39 +0900
Subject: Add `form_with_generates_remote_forms` to configuring guide [ci skip]
---
guides/source/configuring.md | 2 ++
1 file changed, 2 insertions(+)
(limited to 'guides')
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index ae70b06996..3cfb3e2d6a 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -543,6 +543,8 @@ encrypted cookies salt value. Defaults to `'signed encrypted cookie'`.
* `config.action_view.debug_missing_translation` determines whether to wrap the missing translations key in a `` tag or not. This defaults to `true`.
+* `config.form_with_generates_remote_forms` determines whether `form_with` generates remote forms or not. This defaults to `true`.
+
### Configuring Action Mailer
There are a number of settings available on `config.action_mailer`:
--
cgit v1.2.3
From 53b43df3a40e77ceb64c1e3ee8e7190e1ac6d70e Mon Sep 17 00:00:00 2001
From: Koichi ITO
Date: Tue, 25 Apr 2017 07:42:49 +0900
Subject: Unify the name of GitHub [ci skip]
---
guides/source/getting_started.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 18331bb73b..f3ae5a5b28 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -182,7 +182,7 @@ of the files and folders that Rails created by default:
|test/|Unit tests, fixtures, and other test apparatus. These are covered in [Testing Rails Applications](testing.html).|
|tmp/|Temporary files (like cache and pid files).|
|vendor/|A place for all third-party code. In a typical Rails application this includes vendored gems.|
-|.gitignore|This file tells git which files (or patterns) it should ignore. See [Github - Ignoring files](https://help.github.com/articles/ignoring-files) for more info about ignoring files.
+|.gitignore|This file tells git which files (or patterns) it should ignore. See [GitHub - Ignoring files](https://help.github.com/articles/ignoring-files) for more info about ignoring files.
Hello, Rails!
-------------
--
cgit v1.2.3
From c2e3e0d2096836bfb6072af70bd0914a960a50fe Mon Sep 17 00:00:00 2001
From: Jon Moss
Date: Mon, 24 Apr 2017 19:06:31 -0400
Subject: Add missing `action_view` section of config flag
[ci skip]
---
guides/source/configuring.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index 3cfb3e2d6a..bf9456a482 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -543,7 +543,7 @@ encrypted cookies salt value. Defaults to `'signed encrypted cookie'`.
* `config.action_view.debug_missing_translation` determines whether to wrap the missing translations key in a `` tag or not. This defaults to `true`.
-* `config.form_with_generates_remote_forms` determines whether `form_with` generates remote forms or not. This defaults to `true`.
+* `config.action_view.form_with_generates_remote_forms` determines whether `form_with` generates remote forms or not. This defaults to `true`.
### Configuring Action Mailer
--
cgit v1.2.3
From deba47799ff905f778e0c98a015789a1327d5087 Mon Sep 17 00:00:00 2001
From: Matthew Draper
Date: Tue, 25 Apr 2017 17:44:54 -0700
Subject: Describe the changes in transactional tests
---
guides/source/5_1_release_notes.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index ffa18f1a2b..a0fa1680c4 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -225,6 +225,37 @@ can generate form tags based on URLs, scopes or models.
```
+Incompatibilities
+-----------------
+
+The following changes may require immediate action upon upgrade.
+
+### Transactional tests with multiple connections
+
+Transactional tests now wrap all Active Record connections in database
+transactions.
+
+When a test spawns additional threads, and those threads obtain database
+connections, those connections are now handled specially:
+
+The threads will share a single connection, which is inside the managed
+transaction. This ensures all threads see the database in the same
+state, ignoring the outermost transaction. Previously, such additional
+connections were unable to see the fixture rows, for example.
+
+When a thread enters a nested transaction, it will temporarily obtain
+exclusive use of the connection, to maintain isolation.
+
+If your tests currently rely on obtaining a separate,
+outside-of-transaction, connection in a spawned thread, you'll need to
+switch to more explicit connection management.
+
+If your tests spawn threads and those threads interact while also using
+explicit database transactions, this change may introduce a deadlock.
+
+The easy way to opt out of this new behavior is to disable transactional
+tests on any test cases it affects.
+
Railties
--------
--
cgit v1.2.3
From b6ac50b3ee2ff51203774cc0c2647a437237f396 Mon Sep 17 00:00:00 2001
From: Akira Matsuda
Date: Thu, 27 Apr 2017 01:57:03 +0900
Subject: s/broadcasing/broadcasting/
[ci skip]
---
guides/source/5_1_release_notes.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index a0fa1680c4..9c1e6e7e46 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -324,7 +324,7 @@ Please refer to the [Changelog][action-cable] for detailed changes.
* Permit same-origin connections by default.
([commit](https://github.com/rails/rails/commit/dae404473409fcab0e07976aec626df670e52282))
-* Add `ActiveSupport::Notifications` hook for broadcasing data.
+* Add `ActiveSupport::Notifications` hook for broadcasting data.
([Pull Request](https://github.com/rails/rails/pull/24988))
Action Pack
--
cgit v1.2.3
From 80c58a8d905485e685ac3855029b6016738a61c5 Mon Sep 17 00:00:00 2001
From: Robin Dupret
Date: Thu, 27 Apr 2017 00:04:08 +0200
Subject: Some improvements in the 5.1 release notes [ci skip]
---
guides/source/5_1_release_notes.md | 60 ++++++++++++++++++++------------------
1 file changed, 32 insertions(+), 28 deletions(-)
(limited to 'guides')
diff --git a/guides/source/5_1_release_notes.md b/guides/source/5_1_release_notes.md
index 9c1e6e7e46..503498af11 100644
--- a/guides/source/5_1_release_notes.md
+++ b/guides/source/5_1_release_notes.md
@@ -40,7 +40,7 @@ Major Features
[Pull Request](https://github.com/rails/rails/pull/26836)
-Rails 5.1 will allow managing JavaScript dependencies
+Rails 5.1 allows managing JavaScript dependencies
from NPM via Yarn. This will make it easy to use libraries like React, VueJS
or any other library from NPM world. The Yarn support is integrated with
the asset pipeline so that all dependencies will work seamlessly with the
@@ -70,14 +70,14 @@ offerings. It is no longer required, as the UJS has been rewritten to use plain,
vanilla JavaScript. This code now ships inside of Action View as
`rails-ujs`.
-You can still use the jQuery version if needed, but it is no longer required by default.
+You can still use jQuery if needed, but it is no longer required by default.
### System tests
[Pull Request](https://github.com/rails/rails/pull/26703)
Rails 5.1 has baked-in support for writing Capybara tests, in the form of
-System tests. You need no longer worry about configuring Capybara and
+System tests. You no longer need to worry about configuring Capybara and
database cleaning strategies for such tests. Rails 5.1 provides a wrapper
for running tests in Chrome with additional features such as failure
screenshots.
@@ -86,7 +86,7 @@ screenshots.
[Pull Request](https://github.com/rails/rails/pull/28038)
-Rails will now allow management of application secrets in a secure way,
+Rails now allows management of application secrets in a secure way,
building on top of the [sekrets](https://github.com/ahoward/sekrets) gem.
Run `bin/rails secrets:setup` to setup a new encrypted secrets file. This will
@@ -106,33 +106,24 @@ order to share instance variables, headers and other common setup.
``` ruby
class InvitationsMailer < ApplicationMailer
-
before_action { @inviter, @invitee = params[:inviter], params[:invitee] }
before_action { @account = params[:inviter].account }
def account_invitation
mail subject: "#{@inviter.name} invited you to their Basecamp (#{@account.name})"
end
-
- def project_invitation
- @project = params[:project]
- @summarizer = ProjectInvitationSummarizer.new(@project.bucket)
-
- mail subject: "#{@inviter.name.familiar} added you to a project in Basecamp (#{@account.name})"
- end
end
-InvitationsMailer.with(inviter: person_a, invitee: person_b).account_invitation.deliver_later
+InvitationsMailer.with(inviter: person_a, invitee: person_b)
+ .account_invitation.deliver_later
```
### Direct & resolved routes
[Pull Request](https://github.com/rails/rails/pull/23138)
-Rails 5.1 has added two new methods, `resolve` and `direct`, to the routing
-DSL.
-
-The `resolve` method allows customizing polymorphic mapping of models.
+Rails 5.1 adds two new methods, `resolve` and `direct`, to the routing
+DSL. The `resolve` method allows customizing polymorphic mapping of models.
``` ruby
resource :basket
@@ -181,44 +172,57 @@ Before Rails 5.1, there were two interfaces for handling HTML forms:
Rails 5.1 combines both of these interfaces with `form_with`, and
can generate form tags based on URLs, scopes or models.
-``` erb
-# Using just a URL:
+Using just a URL:
+``` erb
<%= form_with url: posts_path do |form| %>
<%= form.text_field :title %>
<% end %>
-# =>
+<%# Will generate %>
+
+```
-# Adding a scope prefixes the input field names:
+Adding a scope prefixes the input field names:
+``` erb
<%= form_with scope: :post, url: posts_path do |form| %>
<%= form.text_field :title %>
<% end %>
-# =>
+
+<%# Will generate %>
+
+```
-# Using a model infers both the URL and scope:
+Using a model infers both the URL and scope:
+``` erb
<%= form_with model: Post.new do |form| %>
<%= form.text_field :title %>
<% end %>
-# =>
+
+<%# Will generate %>
+
+```
-# An existing model makes an update form and fills out field values:
+An existing model makes an update form and fills out field values:
+``` erb
<%= form_with model: Post.first do |form| %>
<%= form.text_field :title %>
<% end %>
-# =>
+
+<%# Will generate %>
+