Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
e517a37c
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e517a37c
编写于
6月 30, 2016
作者:
A
Alex Kitchens
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ci skip] Fix Typos and Punctuation in Guides - Upgrading
上级
3bf0fe4a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
16 deletion
+16
-16
guides/source/upgrading_ruby_on_rails.md
guides/source/upgrading_ruby_on_rails.md
+16
-16
未找到文件。
guides/source/upgrading_ruby_on_rails.md
浏览文件 @
e517a37c
...
...
@@ -201,7 +201,7 @@ need to upgrade your application to first permit and then convert to a hash.
`protect_from_forgery`
defaults to
`prepend: false`
which means that it will be inserted into
the callback chain at the point in which you call it in your application. If you want
`protect_from_forgery`
to always run first you should change your application to use
`protect_from_forgery`
to always run first
, then
you should change your application to use
`protect_from_forgery prepend: true`
.
### Default Template Handler is Now RAW
...
...
@@ -214,7 +214,7 @@ to your file that can be parsed by the appropriate template handler.
### Added Wildcard Matching for Template Dependencies
You can now use wildcard matching for your template dependencies. For example if you were
You can now use wildcard matching for your template dependencies. For example
,
if you were
defining your templates as such:
```
erb
...
...
@@ -237,9 +237,9 @@ The `protected_attributes` gem is no longer supported in Rails 5.
The
`activerecord-deprecated_finders`
gem is no longer supported in Rails 5.
### `ActiveSupport::TestCase` Default Test
R
rder is Now Random
### `ActiveSupport::TestCase` Default Test
O
rder is Now Random
When tests are run in your application the default order is now
`:random`
When tests are run in your application
,
the default order is now
`:random`
instead of
`:sorted`
. Use the following config option to set it back to
`:sorted`
.
```
ruby
...
...
@@ -251,7 +251,11 @@ end
### `ActionController::Live` became a `Concern`
That means that if your application used to have its own streaming module, the following code
If you include
`ActionController::Live`
in another module that is included in your controller, then you
should also extend the module with
`ActiveSupport::Concern`
. Alternatively, you can use the
`self.included`
hook
to include
`ActionController::Live`
directly to the controller once the
`StreamingSupport`
is included.
This means that if your application used to have its own streaming module, the following code
would break in production mode:
```
ruby
...
...
@@ -274,10 +278,6 @@ class StreamingSupport
end
```
If you include
`ActionController::Live`
in another module that is included in your controller you
should also extend the module with
`ActiveSupport::Concern`
. Or you could use the
`self.included`
hook
to include
`ActionController::Live`
directly to the controller once the
`StreamingSupport`
is included.
### New Framework Defaults
#### Active Record `belongs_to` Required by Default Option
...
...
@@ -286,7 +286,7 @@ to include `ActionController::Live` directly to the controller once the `Streami
This can be turned off per-association with
`optional: true`
.
This default will
will
be automatically configured in new applications. If existing application
This default will be automatically configured in new applications. If existing application
want to add this feature it will need to be turned on in an initializer.
config.active_record.belongs_to_required_by_default = true
...
...
@@ -294,14 +294,14 @@ want to add this feature it will need to be turned on in an initializer.
#### 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
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
h
ow configure your application to check if the HTTP
`Origin`
header should be checked
You can
n
ow 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:
...
...
@@ -310,7 +310,7 @@ 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
.
the queue name. Set the following in your config
:
config.action_mailer.deliver_later_queue_name = :new_queue_name
...
...
@@ -324,19 +324,19 @@ should support caching.
#### 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.
dumped. Set to
`:all`
to generate all dumps, or
to
`: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
.
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`
.
When using Ruby 2.4
,
you can preserve the timezone of the receiver when calling
`to_time`
.
ActiveSupport.to_time_preserves_timezone = false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录