Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
88c00937
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,发现更多精彩内容 >>
提交
88c00937
编写于
10月 02, 2013
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove HABTM special cases from associations classes
上级
99185f00
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
1 addition
and
31 deletion
+1
-31
activerecord/lib/active_record/associations/association_scope.rb
...ecord/lib/active_record/associations/association_scope.rb
+0
-12
activerecord/lib/active_record/associations/join_dependency.rb
...erecord/lib/active_record/associations/join_dependency.rb
+1
-1
activerecord/lib/active_record/associations/join_dependency/join_association.rb
...e_record/associations/join_dependency/join_association.rb
+0
-11
activerecord/lib/active_record/associations/join_helper.rb
activerecord/lib/active_record/associations/join_helper.rb
+0
-7
未找到文件。
activerecord/lib/active_record/associations/association_scope.rb
浏览文件 @
88c00937
...
...
@@ -44,18 +44,6 @@ def add_constraints(scope)
chain
.
each_with_index
do
|
reflection
,
i
|
table
,
foreign_table
=
tables
.
shift
,
tables
.
first
if
reflection
.
source_macro
==
:has_and_belongs_to_many
join_table
=
tables
.
shift
scope
=
scope
.
joins
(
join
(
join_table
,
table
[
reflection
.
association_primary_key
].
eq
(
join_table
[
reflection
.
association_foreign_key
])
))
table
,
foreign_table
=
join_table
,
tables
.
first
end
if
reflection
.
source_macro
==
:belongs_to
if
reflection
.
options
[
:polymorphic
]
key
=
reflection
.
association_primary_key
(
self
.
klass
)
...
...
activerecord/lib/active_record/associations/join_dependency.rb
浏览文件 @
88c00937
...
...
@@ -216,7 +216,7 @@ def construct_association(record, join_part, row)
else
association
=
join_part
.
instantiate
(
row
)
unless
row
[
join_part
.
aliased_primary_key
].
nil?
case
macro
when
:has_many
,
:has_and_belongs_to_many
when
:has_many
other
=
record
.
association
(
join_part
.
reflection
.
name
)
other
.
loaded!
other
.
target
.
push
(
association
)
if
association
...
...
activerecord/lib/active_record/associations/join_dependency/join_association.rb
浏览文件 @
88c00937
...
...
@@ -83,17 +83,6 @@ def join_constraints
when
:belongs_to
key
=
reflection
.
association_primary_key
foreign_key
=
reflection
.
foreign_key
when
:has_and_belongs_to_many
# Join the join table first...
joins
<<
join
(
table
,
table
[
reflection
.
foreign_key
].
eq
(
foreign_table
[
reflection
.
active_record_primary_key
]))
foreign_table
,
table
=
table
,
tables
.
shift
key
=
reflection
.
association_primary_key
foreign_key
=
reflection
.
association_foreign_key
else
key
=
reflection
.
foreign_key
foreign_key
=
reflection
.
active_record_primary_key
...
...
activerecord/lib/active_record/associations/join_helper.rb
浏览文件 @
88c00937
...
...
@@ -16,13 +16,6 @@ def construct_tables
table_name_for
(
reflection
),
table_alias_for
(
reflection
,
reflection
!=
self
.
reflection
)
)
if
reflection
.
source_macro
==
:has_and_belongs_to_many
tables
<<
alias_tracker
.
aliased_table_for
(
reflection
.
source_reflection
.
join_table
,
table_alias_for
(
reflection
,
true
)
)
end
end
tables
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录