Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
fa9b4c4e
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 搜索 >>
提交
fa9b4c4e
编写于
3月 12, 2017
作者:
A
Andrew White
提交者:
GitHub
3月 12, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #28372 from kamipo/delegate_as_json
Simply delegate `as_json` to `records`
上级
21a44916
4368dba5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
2 addition
and
6 deletion
+2
-6
activerecord/lib/active_record/relation.rb
activerecord/lib/active_record/relation.rb
+0
-4
activerecord/lib/active_record/relation/delegation.rb
activerecord/lib/active_record/relation/delegation.rb
+1
-1
activerecord/test/cases/relation/delegation_test.rb
activerecord/test/cases/relation/delegation_test.rb
+1
-1
未找到文件。
activerecord/lib/active_record/relation.rb
浏览文件 @
fa9b4c4e
...
...
@@ -261,10 +261,6 @@ def encode_with(coder)
coder
.
represent_seq
(
nil
,
records
)
end
def
as_json
(
options
=
nil
)
#:nodoc:
records
.
as_json
(
options
)
end
# Returns size of the records.
def
size
loaded?
?
@records
.
length
:
count
(
:all
)
...
...
activerecord/lib/active_record/relation/delegation.rb
浏览文件 @
fa9b4c4e
...
...
@@ -38,7 +38,7 @@ def inherited(child_class)
delegate
:to_xml
,
:encode_with
,
:length
,
:collect
,
:map
,
:each
,
:all?
,
:include?
,
:to_ary
,
:join
,
:[]
,
:&
,
:|
,
:
+
,
:
-
,
:sample
,
:reverse
,
:compact
,
:in_groups
,
:in_groups_of
,
:to_sentence
,
:to_formatted_s
,
:to_sentence
,
:to_formatted_s
,
:as_json
,
:shuffle
,
:split
,
:index
,
to: :records
delegate
:table_name
,
:quoted_table_name
,
:primary_key
,
:quoted_primary_key
,
...
...
activerecord/test/cases/relation/delegation_test.rb
浏览文件 @
fa9b4c4e
...
...
@@ -33,7 +33,7 @@ module DelegationWhitelistBlacklistTests
:map
,
:none?
,
:one?
,
:partition
,
:reject
,
:reverse
,
:sample
,
:second
,
:sort
,
:sort_by
,
:third
,
:to_ary
,
:to_set
,
:to_xml
,
:to_yaml
,
:join
,
:in_groups
,
:in_groups_of
,
:to_sentence
,
:to_formatted_s
:in_groups
,
:in_groups_of
,
:to_sentence
,
:to_formatted_s
,
:as_json
]
ARRAY_DELEGATES
.
each
do
|
method
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录