Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
d8bd19f6
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,发现更多精彩内容 >>
提交
d8bd19f6
编写于
5月 24, 2011
作者:
A
Andrew White
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ignore :includes on through associations
上级
a47a65f1
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
16 addition
and
1 deletion
+16
-1
activerecord/lib/active_record/associations/through_association.rb
...ord/lib/active_record/associations/through_association.rb
+1
-1
activerecord/test/cases/associations/eager_test.rb
activerecord/test/cases/associations/eager_test.rb
+6
-0
activerecord/test/models/author.rb
activerecord/test/models/author.rb
+3
-0
activerecord/test/models/post.rb
activerecord/test/models/post.rb
+6
-0
未找到文件。
activerecord/lib/active_record/associations/through_association.rb
浏览文件 @
d8bd19f6
...
...
@@ -16,7 +16,7 @@ def target_scope
chain
[
1
..-
1
].
each
do
|
reflection
|
scope
=
scope
.
merge
(
reflection
.
klass
.
scoped
.
with_default_scope
.
except
(
:select
,
:create_with
)
except
(
:select
,
:create_with
,
:includes
)
)
end
scope
...
...
activerecord/test/cases/associations/eager_test.rb
浏览文件 @
d8bd19f6
...
...
@@ -448,6 +448,12 @@ def test_eager_with_has_many_through_with_conditions_join_model_with_include
assert_equal
post_tags
,
eager_post_tags
end
def
test_eager_with_has_many_through_join_model_ignores_default_includes
assert_nothing_raised
do
authors
(
:david
).
comments_on_posts_with_default_include
.
to_a
end
end
def
test_eager_with_has_many_and_limit
posts
=
Post
.
find
(
:all
,
:order
=>
'posts.id asc'
,
:include
=>
[
:author
,
:comments
],
:limit
=>
2
)
assert_equal
2
,
posts
.
size
...
...
activerecord/test/models/author.rb
浏览文件 @
d8bd19f6
...
...
@@ -138,6 +138,9 @@ def testing_proxy_target
has_many
:misc_post_first_blue_tags_2
,
:through
=>
:posts
,
:source
=>
:first_blue_tags_2
,
:conditions
=>
{
:posts
=>
{
:title
=>
[
'misc post by bob'
,
'misc post by mary'
]
}
}
has_many
:posts_with_default_include
,
:class_name
=>
'PostWithDefaultInclude'
has_many
:comments_on_posts_with_default_include
,
:through
=>
:posts_with_default_include
,
:source
=>
:comments
scope
:relation_include_posts
,
includes
(
:posts
)
scope
:relation_include_tags
,
includes
(
:tags
)
...
...
activerecord/test/models/post.rb
浏览文件 @
d8bd19f6
...
...
@@ -162,3 +162,9 @@ class FirstPost < ActiveRecord::Base
has_many
:comments
,
:foreign_key
=>
:post_id
has_one
:comment
,
:foreign_key
=>
:post_id
end
class
PostWithDefaultInclude
<
ActiveRecord
::
Base
self
.
table_name
=
'posts'
default_scope
includes
(
:comments
)
has_many
:comments
,
:foreign_key
=>
:post_id
end
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录