aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--guides/assets/images/getting_started/template_is_missing_articles_new.pngbin6174 -> 587962 bytes
-rw-r--r--guides/source/5_0_release_notes.md37
-rw-r--r--guides/source/configuring.md2
-rw-r--r--guides/source/getting_started.md22
-rw-r--r--guides/source/upgrading_ruby_on_rails.md48
5 files changed, 91 insertions, 18 deletions
diff --git a/guides/assets/images/getting_started/template_is_missing_articles_new.png b/guides/assets/images/getting_started/template_is_missing_articles_new.png
index 4e636d09ff..f4f054f3c6 100644
--- a/guides/assets/images/getting_started/template_is_missing_articles_new.png
+++ b/guides/assets/images/getting_started/template_is_missing_articles_new.png
Binary files differ
diff --git a/guides/source/5_0_release_notes.md b/guides/source/5_0_release_notes.md
index 7b5c6cf345..3832109987 100644
--- a/guides/source/5_0_release_notes.md
+++ b/guides/source/5_0_release_notes.md
@@ -257,7 +257,6 @@ Please refer to the [Changelog][railties] for detailed changes.
Spring to watch additional common files.
([commit](https://github.com/rails/rails/commit/b04d07337fd7bc17e88500e9d6bcd361885a45f8))
-
* Added `--skip-action-mailer` to skip Action Mailer while generating new app.
([Pull Request](https://github.com/rails/rails/pull/18288))
@@ -267,6 +266,9 @@ Please refer to the [Changelog][railties] for detailed changes.
* Changed `_form.html.erb` generated by scaffold generator to use local variables.
([Pull Request](https://github.com/rails/rails/pull/13434))
+* Disabled autoloading of classes in production environment.
+ ([commit](https://github.com/rails/rails/commit/a71350cae0082193ad8c66d65ab62e8bb0b7853b))
+
Action Pack
-----------
@@ -441,6 +443,10 @@ Please refer to the [Changelog][action-pack] for detailed changes.
* Discarded flash messages get removed before storing into session.
([Pull Request](https://github.com/rails/rails/pull/18721))
+* Added support for passing collection of records to `fresh_when` and
+ `stale?`.
+ ([Pull Request](https://github.com/rails/rails/pull/18374))
+
Action View
-------------
@@ -643,6 +649,18 @@ Please refer to the [Changelog][active-record] for detailed changes.
`use_transactional_tests` for more clarity.
([Pull Request](https://github.com/rails/rails/pull/19282))
+* Deprecated passing a column to `ActiveRecord::Connection#quote`.
+ ([commit](https://github.com/rails/rails/commit/7bb620869725ad6de603f6a5393ee17df13aa96c))
+
+* Deprecated passing of `start` value to `find_in_batches` and `find_each`
+ in favour of `begin_at`.
+ ([Pull Request](https://github.com/rails/rails/pull/18961))
+
+* Added an option `end` to `find_in_batches` that complements the `start`
+ parameter to specify where to stop batch processing.
+ ([Pull Request](https://github.com/rails/rails/pull/12257))
+
+
### Notable changes
* Added a `foreign_key` option to `references` while creating the table.
@@ -765,6 +783,20 @@ Please refer to the [Changelog][active-record] for detailed changes.
* Added `:index_errors` option to add indexes to errors of nested attributes.
([Pull Request](https://github.com/rails/rails/pull/19686))
+* Added support for bidirectional destroy dependencies.
+ ([Pull Request](https://github.com/rails/rails/pull/18548))
+
+* Added support for `after_commit` callbacks in transactional tests.
+ ([Pull Request](https://github.com/rails/rails/pull/18458))
+
+* Added `foreign_key_exists?` method to see if a foreign key exists on a table
+ or not.
+ ([Pull Request](https://github.com/rails/rails/pull/18662))
+
+* Added `:time` option to `touch` method to touch records with different time
+ than the current time.
+ ([Pull Request](https://github.com/rails/rails/pull/18956))
+
Active Model
------------
@@ -818,6 +850,9 @@ Please refer to the [Changelog][active-model] for detailed changes.
* Validate multiple contexts on `valid?` and `invalid?` at once.
([Pull Request](https://github.com/rails/rails/pull/21069))
+* Change `validates_acceptance_of` to accept `true` as default value
+ apart from `1`.
+ ([Pull Request](https://github.com/rails/rails/pull/18439))
Active Job
-----------
diff --git a/guides/source/configuring.md b/guides/source/configuring.md
index 1f7e9cc61f..59cf412c5f 100644
--- a/guides/source/configuring.md
+++ b/guides/source/configuring.md
@@ -94,7 +94,7 @@ application. Accepts a valid week day symbol (e.g. `:monday`).
* `config.eager_load_paths` accepts an array of paths from which Rails will eager load on boot if cache classes is enabled. Defaults to every folder in the `app` directory of the application.
-* `config.enable_dependency_loading`: when true, enables autoload loading, even if the application is eager loaded and `config.cache_classes` is set as true. Defaults to false.
+* `config.enable_dependency_loading`: when true, enables autoloading, even if the application is eager loaded and `config.cache_classes` is set as true. Defaults to false.
* `config.encoding` sets up the application-wide encoding. Defaults to UTF-8.
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index e0832a32a6..b0d3953cbd 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -313,8 +313,6 @@ It should look something like the following:
Rails.application.routes.draw do
get 'welcome/index'
- # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
-
root 'welcome#index'
end
```
@@ -457,7 +455,7 @@ available, Rails will raise an exception.
In the above image, the bottom line has been truncated. Let's see what the full
error message looks like:
->Missing template articles/new, application/new with {locale:[:en], formats:[:html], handlers:[:erb, :builder, :coffee]}. Searched in: * "/path/to/blog/app/views"
+>ArticlesController#new is missing a template for this request format and variant. request.formats: ["text/html"] request.variant: [] NOTE! For XHR/Ajax or API requests, this action would normally respond with 204 No Content: an empty white screen. Since you're loading it in a web browser, we assume that you expected to actually render a template, not… nothing, so we're showing an error to be extra-clear. If you expect 204 No Content, carry on. That's what you'll get from an XHR or API request. Give it a shot.
That's quite a lot of text! Let's quickly go through and understand what each
part of it means.
@@ -476,9 +474,9 @@ us what _template handlers_ could be used to render our template. `:erb` is most
commonly used for HTML templates, `:builder` is used for XML templates, and
`:coffee` uses CoffeeScript to build JavaScript templates.
-The final part of this message tells us where Rails has looked for the templates.
-Templates within a basic Rails application like this are kept in a single
-location, but in more complex applications it could be many different paths.
+The message also contains `request.formats` which specifies the format of template to be
+served in response. It is set to `text/html` as we requested this page via browser, so Rails
+is looking for an HTML template.
The simplest template that would work in this case would be one located at
`app/views/articles/new.html.erb`. The extension of this file name is important:
@@ -486,7 +484,9 @@ the first extension is the _format_ of the template, and the second extension
is the _handler_ that will be used. Rails is attempting to find a template
called `articles/new` within `app/views` for the application. The format for
this template can only be `html` and the handler must be one of `erb`,
-`builder` or `coffee`. Because you want to create a new HTML form, you will be
+`builder` or `coffee`. `:erb` is most commonly used for HTML templates, `:builder` is
+used for XML templates, and `:coffee` uses CoffeeScript to build JavaScript templates.
+Because you want to create a new HTML form, you will be
using the `ERB` language which is designed to embed Ruby in HTML.
Therefore the file should be called `articles/new.html.erb` and needs to be
@@ -606,9 +606,11 @@ class ArticlesController < ApplicationController
end
```
-If you re-submit the form now, you'll see another familiar error: a template is
-missing. That's ok, we can ignore that for now. What the `create` action should
-be doing is saving our new article to the database.
+If you re-submit the form now, you may not see any change on the page. Don't worry!
+This is because Rails by default returns `204 No Content` response for an action if
+we don't specify what the response should be. We just added the `create` action
+but didn't specify anything about how the response should be. In this case, the
+`create` action should save our new article to the database.
When a form is submitted, the fields of the form are sent to Rails as
_parameters_. These parameters can then be referenced inside the controller
diff --git a/guides/source/upgrading_ruby_on_rails.md b/guides/source/upgrading_ruby_on_rails.md
index cbe46d6c0d..b7fbf9963b 100644
--- a/guides/source/upgrading_ruby_on_rails.md
+++ b/guides/source/upgrading_ruby_on_rails.md
@@ -145,6 +145,12 @@ your Gemfile.
If you are using Rspec for testing please see the extra configuration required in the gem's
documentation.
+### Autoloading is disabled in production environment
+
+Autoloading of classes is now disabled in production environment by default. If your code
+is dependent on autoloading in production, then you can opt out by setting
+`Rails.application.config.enable_dependency_loading` to true.
+
### XML Serialization
`ActiveModel::Serializers::Xml` has been extracted from Rails to the `activemodel-serializers-xml`
@@ -233,9 +239,9 @@ Rails.application.configure do
end
```
-### New config options
+### New Framework Defaults
-## Active Record `belongs_to` Required by Default Option
+#### Active Record `belongs_to` Required by Default Option
`belongs_to` will now trigger a validation error by default if the association is not present.
@@ -246,25 +252,55 @@ want to add this feature it will need to be turned on in an initializer.
config.active_record.belongs_to_required_by_default = true
-## Allow configuration of Action Mailer queue name
+#### Per-form CSRF tokens
+
+Rails 5 now supports per-form CSRF tokens to mitigate against code-injection attacks with forms
+created by JavaScript. With this option turned on forms in your application will each have their
+own CSRF token that is specified to the action and method for that form.
+
+ config.action_controller.per_form_csrf_tokens = true
+
+#### Forgery protection with origin check
+
+You can how configure your application to check if the HTTP `Origin` header should be checked
+against the site's origin as an additional CSRF defense. Set the following in your config to
+true:
+
+ config.action_controller.forgery_protection_origin_check = true
+
+#### Allow configuration of Action Mailer queue name
The default mailer queue name is `mailers`. This configuration option allows you to globally change
the queue name. Set the following in your config.
- config.action_mailer.deliver_later_queue_name
+ config.action_mailer.deliver_later_queue_name = :new_queue_name
-## Support fragment caching in Action Mailer views
+#### Support fragment caching in Action Mailer views
Set `config.action_mailer.perform_caching` in your config to determine whether your Action Mailer views
should support caching.
-## Configure the output of `db:structure:dump`
+ config.action_mailer.perform_caching = true
+
+#### Configure the output of `db:structure:dump`
If you're using `schema_search_path` or other PostgreSQL extentions, you can control how the schema is
dumped. Set to `:all` to generate all dumps, or `:schema_search_path` to generate from schema search path.
config.active_record.dump_schemas = :all
+#### Configure SSL options to enable HSTS with subdomains
+
+Set the following in your config to enable HSTS when using subdomains.
+
+ config.ssl_options = { hsts: { subdomains: true } }
+
+#### Preserve timezone of the receiver
+
+When using Ruby 2.4 you can preserve the timezone of the receiver when calling `to_time`.
+
+ ActiveSupport.to_time_preserves_timezone = false
+
Upgrading from Rails 4.1 to Rails 4.2
-------------------------------------