Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
26a50081
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 搜索 >>
未验证
提交
26a50081
编写于
6月 24, 2020
作者:
R
Rafael França
提交者:
GitHub
6月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Deprecate YAML loading from legacy format older than Rails 5.0"
上级
0601a9f9
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
5 addition
and
17 deletion
+5
-17
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+0
-4
activerecord/lib/active_record/legacy_yaml_adapter.rb
activerecord/lib/active_record/legacy_yaml_adapter.rb
+3
-7
activerecord/test/cases/yaml_serialization_test.rb
activerecord/test/cases/yaml_serialization_test.rb
+2
-6
未找到文件。
activerecord/CHANGELOG.md
浏览文件 @
26a50081
*
Deprecate YAML loading from legacy format older than Rails 5.0.
*Ryuta Kamizono*
*
Added the setting
`ActiveRecord::Base.immutable_strings_by_default`
, which
allows you to specify that all string columns should be frozen unless
otherwise specified. This will reduce memory pressure for applications which
...
...
activerecord/lib/active_record/legacy_yaml_adapter.rb
浏览文件 @
26a50081
# frozen_string_literal: true
module
ActiveRecord
module
LegacyYamlAdapter
# :nodoc:
module
LegacyYamlAdapter
def
self
.
convert
(
klass
,
coder
)
return
coder
unless
coder
.
is_a?
(
Psych
::
Coder
)
case
coder
[
"active_record_yaml_version"
]
when
1
,
2
then
coder
else
ActiveSupport
::
Deprecation
.
warn
(
<<-
MSG
.
squish
)
YAML loading from legacy format older than Rails 5.0 is deprecated
and will be removed in Rails 6.2.
MSG
if
coder
[
"attributes"
].
is_a?
(
ActiveModel
::
AttributeSet
)
Rails420
.
convert
(
klass
,
coder
)
else
...
...
@@ -20,7 +16,7 @@ def self.convert(klass, coder)
end
end
module
Rails420
# :nodoc:
module
Rails420
def
self
.
convert
(
klass
,
coder
)
attribute_set
=
coder
[
"attributes"
]
...
...
@@ -36,7 +32,7 @@ def self.convert(klass, coder)
end
end
module
Rails41
# :nodoc:
module
Rails41
def
self
.
convert
(
klass
,
coder
)
attributes
=
klass
.
attributes_builder
.
build_from_database
(
coder
[
"attributes"
])
...
...
activerecord/test/cases/yaml_serialization_test.rb
浏览文件 @
26a50081
...
...
@@ -94,9 +94,7 @@ def test_a_yaml_version_is_provided_for_future_backwards_compat
end
def
test_deserializing_rails_41_yaml
topic
=
assert_deprecated
do
YAML
.
load
(
yaml_fixture
(
"rails_4_1"
))
end
topic
=
YAML
.
load
(
yaml_fixture
(
"rails_4_1"
))
assert_predicate
topic
,
:new_record?
assert_nil
topic
.
id
...
...
@@ -105,9 +103,7 @@ def test_deserializing_rails_41_yaml
end
def
test_deserializing_rails_4_2_0_yaml
topic
=
assert_deprecated
do
YAML
.
load
(
yaml_fixture
(
"rails_4_2_0"
))
end
topic
=
YAML
.
load
(
yaml_fixture
(
"rails_4_2_0"
))
assert_not_predicate
topic
,
:new_record?
assert_equal
1
,
topic
.
id
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录