Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
5d548151
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
5d548151
编写于
11月 17, 2018
作者:
J
Jasper Maes
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rails5: Passing a class as a value in an Active Record query is deprecated
上级
29d8179b
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
15 addition
and
10 deletion
+15
-10
app/finders/events_finder.rb
app/finders/events_finder.rb
+1
-1
app/models/ci/build.rb
app/models/ci/build.rb
+2
-2
app/models/concerns/avatarable.rb
app/models/concerns/avatarable.rb
+1
-1
app/services/todos/destroy/entity_leave_service.rb
app/services/todos/destroy/entity_leave_service.rb
+1
-1
app/services/todos/destroy/private_features_service.rb
app/services/todos/destroy/private_features_service.rb
+3
-3
changelogs/unreleased/rails5-active-record-class-value.yml
changelogs/unreleased/rails5-active-record-class-value.yml
+5
-0
spec/finders/pending_todos_finder_spec.rb
spec/finders/pending_todos_finder_spec.rb
+1
-1
spec/models/todo_spec.rb
spec/models/todo_spec.rb
+1
-1
未找到文件。
app/finders/events_finder.rb
浏览文件 @
5d548151
...
...
@@ -58,7 +58,7 @@ class EventsFinder
def
by_target_type
(
events
)
return
events
unless
Event
::
TARGET_TYPES
[
params
[
:target_type
]]
events
.
where
(
target_type:
Event
::
TARGET_TYPES
[
params
[
:target_type
]])
events
.
where
(
target_type:
Event
::
TARGET_TYPES
[
params
[
:target_type
]]
.
name
)
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/models/ci/build.rb
浏览文件 @
5d548151
...
...
@@ -98,7 +98,7 @@ module Ci
scope
:matches_tag_ids
,
->
(
tag_ids
)
do
matcher
=
::
ActsAsTaggableOn
::
Tagging
.
where
(
taggable_type:
CommitStatus
)
.
where
(
taggable_type:
CommitStatus
.
name
)
.
where
(
context:
'tags'
)
.
where
(
'taggable_id = ci_builds.id'
)
.
where
.
not
(
tag_id:
tag_ids
).
select
(
'1'
)
...
...
@@ -108,7 +108,7 @@ module Ci
scope
:with_any_tags
,
->
do
matcher
=
::
ActsAsTaggableOn
::
Tagging
.
where
(
taggable_type:
CommitStatus
)
.
where
(
taggable_type:
CommitStatus
.
name
)
.
where
(
context:
'tags'
)
.
where
(
'taggable_id = ci_builds.id'
).
select
(
'1'
)
...
...
app/models/concerns/avatarable.rb
浏览文件 @
5d548151
...
...
@@ -86,7 +86,7 @@ module Avatarable
params
[
:model
].
upload_paths
(
params
[
:identifier
])
end
Upload
.
where
(
uploader:
AvatarUploader
,
path:
paths
).
find_each
do
|
upload
|
Upload
.
where
(
uploader:
AvatarUploader
.
name
,
path:
paths
).
find_each
do
|
upload
|
model
=
model_class
.
instantiate
(
'id'
=>
upload
.
model_id
)
loader
.
call
({
model:
model
,
identifier:
File
.
basename
(
upload
.
path
)
},
upload
)
...
...
app/services/todos/destroy/entity_leave_service.rb
浏览文件 @
5d548151
...
...
@@ -45,7 +45,7 @@ module Todos
# rubocop: disable CodeReuse/ActiveRecord
def
remove_confidential_issue_todos
Todo
.
where
(
target_id:
confidential_issues
.
select
(
:id
),
target_type:
Issue
,
user_id:
user
.
id
target_id:
confidential_issues
.
select
(
:id
),
target_type:
Issue
.
name
,
user_id:
user
.
id
).
delete_all
end
# rubocop: enable CodeReuse/ActiveRecord
...
...
app/services/todos/destroy/private_features_service.rb
浏览文件 @
5d548151
...
...
@@ -14,9 +14,9 @@ module Todos
def
execute
ProjectFeature
.
where
(
project_id:
project_ids
).
each
do
|
project_features
|
target_types
=
[]
target_types
<<
Issue
if
private
?(
project_features
.
issues_access_level
)
target_types
<<
MergeRequest
if
private
?(
project_features
.
merge_requests_access_level
)
target_types
<<
Commit
if
private
?(
project_features
.
repository_access_level
)
target_types
<<
Issue
.
name
if
private
?(
project_features
.
issues_access_level
)
target_types
<<
MergeRequest
.
name
if
private
?(
project_features
.
merge_requests_access_level
)
target_types
<<
Commit
.
name
if
private
?(
project_features
.
repository_access_level
)
next
if
target_types
.
empty?
...
...
changelogs/unreleased/rails5-active-record-class-value.yml
0 → 100644
浏览文件 @
5d548151
---
title
:
'
Rails5:
Passing
a
class
as
a
value
in
an
Active
Record
query
is
deprecated'
merge_request
:
23164
author
:
Jasper Maes
type
:
other
spec/finders/pending_todos_finder_spec.rb
浏览文件 @
5d548151
...
...
@@ -46,7 +46,7 @@ describe PendingTodosFinder do
create
(
:todo
,
:pending
,
user:
user
,
target:
note
)
todos
=
described_class
.
new
(
user
,
target_type:
issue
.
class
).
execute
todos
=
described_class
.
new
(
user
,
target_type:
issue
.
class
.
name
).
execute
expect
(
todos
).
to
eq
([
todo
])
end
...
...
spec/models/todo_spec.rb
浏览文件 @
5d548151
...
...
@@ -226,7 +226,7 @@ describe Todo do
create
(
:todo
,
target:
create
(
:merge_request
))
expect
(
described_class
.
for_type
(
Issue
)).
to
eq
([
todo
])
expect
(
described_class
.
for_type
(
Issue
.
name
)).
to
eq
([
todo
])
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录