aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRobin Dupret <robin.dupret@gmail.com>2017-04-27 00:04:08 +0200
committerRobin Dupret <robin.dupret@gmail.com>2017-04-27 00:04:08 +0200
commit80c58a8d905485e685ac3855029b6016738a61c5 (patch)
treef3761baf4faaaf50010e12fa2c0144e1baea913b /guides
parenteac6f3690fd245b9d72aadcfa365ed16c4ef8b96 (diff)
downloadrails-80c58a8d905485e685ac3855029b6016738a61c5.tar.gz
rails-80c58a8d905485e685ac3855029b6016738a61c5.tar.bz2
rails-80c58a8d905485e685ac3855029b6016738a61c5.zip
Some improvements in the 5.1 release notes [ci skip]
Diffstat (limited to 'guides')
-rw-r--r--guides/source/5_1_release_notes.md60
1 files changed, 32 insertions, 28 deletions
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 %>
+
<form action="/posts" method="post" data-remote="true">
<input type="text" name="title">
</form>
+```
-# 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 %>
+
<form action="/posts" method="post" data-remote="true">
<input type="text" name="post[title]">
</form>
+```
-# 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 %>
+
<form action="/posts" method="post" data-remote="true">
<input type="text" name="post[title]">
</form>
+```
-# 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 %>
+
<form action="/posts/1" method="post" data-remote="true">
<input type="hidden" name="_method" value="patch">
<input type="text" name="post[title]" value="<the title of the post>">
@@ -264,7 +268,7 @@ Please refer to the [Changelog][railties] for detailed changes.
### Removals
* Remove deprecated `config.static_cache_control`.
- ([commit](https://github.com/rails/rails/commit/c861decd44198f8d7d774ee6a74194d1ac1a5a13)
+ ([commit](https://github.com/rails/rails/commit/c861decd44198f8d7d774ee6a74194d1ac1a5a13))
* Remove deprecated `config.serve_static_files`.
([commit](https://github.com/rails/rails/commit/0129ca2eeb6d5b2ea8c6e6be38eeb770fe45f1fa))
@@ -298,7 +302,7 @@ Please refer to the [Changelog][railties] for detailed changes.
* 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
+* 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))