Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5c76d010
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,发现更多精彩内容 >>
提交
5c76d010
编写于
12月 30, 2016
作者:
R
Rafael França
提交者:
GitHub
12月 30, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #27509 from kamipo/remove_remaining_deprecations
Remove remaining ActiveRecord deprecations
上级
18325d73
c6dcc37b
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
9 addition
and
58 deletion
+9
-58
activerecord/CHANGELOG.md
activerecord/CHANGELOG.md
+8
-0
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
...ecord/connection_adapters/abstract/database_statements.rb
+0
-6
activerecord/lib/active_record/relation.rb
activerecord/lib/active_record/relation.rb
+0
-9
activerecord/lib/active_record/relation/query_methods.rb
activerecord/lib/active_record/relation/query_methods.rb
+0
-4
activerecord/test/cases/base_test.rb
activerecord/test/cases/base_test.rb
+0
-6
activerecord/test/cases/calculations_test.rb
activerecord/test/cases/calculations_test.rb
+0
-4
activerecord/test/cases/database_statements_test.rb
activerecord/test/cases/database_statements_test.rb
+0
-6
activerecord/test/cases/relation/mutation_test.rb
activerecord/test/cases/relation/mutation_test.rb
+1
-17
activerecord/test/cases/relations_test.rb
activerecord/test/cases/relations_test.rb
+0
-6
未找到文件。
activerecord/CHANGELOG.md
浏览文件 @
5c76d010
*
Remove deprecated
`#uniq`
,
`#uniq!`
, and
`#uniq_value`
.
*Ryuta Kamizono*
*
Remove deprecated
`#insert_sql`
,
`#update_sql`
, and
`#delete_sql`
.
*Ryuta Kamizono*
*
Remove deprecated
`#use_transactional_fixtures`
configuration.
*Rafael Mendonça França*
...
...
activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
浏览文件 @
5c76d010
...
...
@@ -126,22 +126,16 @@ def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, bind
id_value
||
last_inserted_id
(
value
)
end
alias
create
insert
alias
insert_sql
insert
deprecate
insert_sql: :insert
# Executes the update statement and returns the number of rows affected.
def
update
(
arel
,
name
=
nil
,
binds
=
[])
exec_update
(
to_sql
(
arel
,
binds
),
name
,
binds
)
end
alias
update_sql
update
deprecate
update_sql: :update
# Executes the delete statement and returns the number of rows affected.
def
delete
(
arel
,
name
=
nil
,
binds
=
[])
exec_delete
(
to_sql
(
arel
,
binds
),
name
,
binds
)
end
alias
delete_sql
delete
deprecate
delete_sql: :delete
# Returns +true+ when the connection adapter supports prepared statement
# caching, otherwise returns +false+
...
...
activerecord/lib/active_record/relation.rb
浏览文件 @
5c76d010
...
...
@@ -614,15 +614,6 @@ def joined_includes_values
includes_values
&
joins_values
end
# {#uniq}[rdoc-ref:QueryMethods#uniq] and
# {#uniq!}[rdoc-ref:QueryMethods#uniq!] are silently deprecated.
# #uniq_value delegates to #distinct_value to maintain backwards compatibility.
# Use #distinct_value instead.
def
uniq_value
distinct_value
end
deprecate
uniq_value: :distinct_value
# Compares two relations for equality.
def
==
(
other
)
case
other
...
...
activerecord/lib/active_record/relation/query_methods.rb
浏览文件 @
5c76d010
...
...
@@ -839,16 +839,12 @@ def from!(value, subquery_name = nil) # :nodoc:
def
distinct
(
value
=
true
)
spawn
.
distinct!
(
value
)
end
alias
uniq
distinct
deprecate
uniq: :distinct
# Like #distinct, but modifies relation in place.
def
distinct!
(
value
=
true
)
# :nodoc:
self
.
distinct_value
=
value
self
end
alias
uniq!
distinct!
deprecate
uniq!: :distinct!
# Used to extend a scope with additional methods, either through
# a module or through a block provided.
...
...
activerecord/test/cases/base_test.rb
浏览文件 @
5c76d010
...
...
@@ -1369,12 +1369,6 @@ def test_touch_should_raise_error_on_a_new_object
end
end
def
test_uniq_delegates_to_scoped
assert_deprecated
do
assert_equal
Bird
.
all
.
distinct
,
Bird
.
uniq
end
end
def
test_distinct_delegates_to_scoped
assert_equal
Bird
.
all
.
distinct
,
Bird
.
distinct
end
...
...
activerecord/test/cases/calculations_test.rb
浏览文件 @
5c76d010
...
...
@@ -421,10 +421,6 @@ def test_count_with_arel_star
def
test_count_with_distinct
assert_equal
4
,
Account
.
select
(
:credit_limit
).
distinct
.
count
assert_deprecated
do
assert_equal
4
,
Account
.
select
(
:credit_limit
).
uniq
.
count
end
end
def
test_count_with_aliased_attribute
...
...
activerecord/test/cases/database_statements_test.rb
浏览文件 @
5c76d010
...
...
@@ -20,12 +20,6 @@ def test_create_should_return_the_inserted_id
assert_not_nil
return_the_inserted_id
(
method: :create
)
end
def
test_insert_update_delete_sql_is_deprecated
assert_deprecated
{
@connection
.
insert_sql
(
"INSERT INTO accounts (firm_id,credit_limit) VALUES (42,5000)"
)
}
assert_deprecated
{
@connection
.
update_sql
(
"UPDATE accounts SET credit_limit = 6000 WHERE firm_id = 42"
)
}
assert_deprecated
{
@connection
.
delete_sql
(
"DELETE FROM accounts WHERE firm_id = 42"
)
}
end
private
def
return_the_inserted_id
(
method
:)
...
...
activerecord/test/cases/relation/mutation_test.rb
浏览文件 @
5c76d010
...
...
@@ -90,7 +90,7 @@ def relation
assert_equal
[],
relation
.
extending_values
end
(
Relation
::
SINGLE_VALUE_METHODS
-
[
:lock
,
:reordering
,
:reverse_order
,
:create_with
,
:uniq
]).
each
do
|
method
|
(
Relation
::
SINGLE_VALUE_METHODS
-
[
:lock
,
:reordering
,
:reverse_order
,
:create_with
]).
each
do
|
method
|
test
"#
#{
method
}
!"
do
assert
relation
.
public_send
(
"
#{
method
}
!"
,
:foo
).
equal?
(
relation
)
assert_equal
:foo
,
relation
.
public_send
(
"
#{
method
}
_value"
)
...
...
@@ -161,22 +161,6 @@ def relation
test
"distinct!"
do
relation
.
distinct!
:foo
assert_equal
:foo
,
relation
.
distinct_value
assert_deprecated
do
assert_equal
:foo
,
relation
.
uniq_value
# deprecated access
end
end
test
"uniq! was replaced by distinct!"
do
assert_deprecated
(
/use distinct! instead/
)
do
relation
.
uniq!
:foo
end
assert_deprecated
(
/use distinct_value instead/
)
do
assert_equal
:foo
,
relation
.
uniq_value
# deprecated access
end
assert_equal
:foo
,
relation
.
distinct_value
end
end
end
activerecord/test/cases/relations_test.rb
浏览文件 @
5c76d010
...
...
@@ -1633,17 +1633,11 @@ def test_distinct
assert_equal
[
"Foo"
,
"Foo"
],
query
.
map
(
&
:name
)
assert_sql
(
/DISTINCT/
)
do
assert_equal
[
"Foo"
],
query
.
distinct
.
map
(
&
:name
)
assert_deprecated
{
assert_equal
[
"Foo"
],
query
.
uniq
.
map
(
&
:name
)
}
end
assert_sql
(
/DISTINCT/
)
do
assert_equal
[
"Foo"
],
query
.
distinct
(
true
).
map
(
&
:name
)
assert_deprecated
{
assert_equal
[
"Foo"
],
query
.
uniq
(
true
).
map
(
&
:name
)
}
end
assert_equal
[
"Foo"
,
"Foo"
],
query
.
distinct
(
true
).
distinct
(
false
).
map
(
&
:name
)
assert_deprecated
do
assert_equal
[
"Foo"
,
"Foo"
],
query
.
uniq
(
true
).
uniq
(
false
).
map
(
&
:name
)
end
end
def
test_doesnt_add_having_values_if_options_are_blank
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录