Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5864b9a8
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,发现更多精彩内容 >>
提交
5864b9a8
编写于
10月 02, 2013
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
remove HABTM associations
上级
957d7ae0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
0 addition
and
66 deletion
+0
-66
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+0
-7
activerecord/lib/active_record/associations/association.rb
activerecord/lib/active_record/associations/association.rb
+0
-1
activerecord/lib/active_record/associations/builder/association.rb
...ord/lib/active_record/associations/builder/association.rb
+0
-1
activerecord/lib/active_record/associations/collection_association.rb
.../lib/active_record/associations/collection_association.rb
+0
-1
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
...ecord/associations/has_and_belongs_to_many_association.rb
+0
-56
未找到文件。
activerecord/lib/active_record/associations.rb
浏览文件 @
5864b9a8
...
...
@@ -73,12 +73,6 @@ def initialize(owner, reflection)
end
end
class
HasAndBelongsToManyAssociationForeignKeyNeeded
<
ActiveRecordError
#:nodoc:
def
initialize
(
reflection
)
super
(
"Cannot create self referential has_and_belongs_to_many association on '
#{
reflection
.
class_name
rescue
nil
}
#
#{
reflection
.
name
rescue
nil
}
'. :association_foreign_key cannot be the same as the :foreign_key."
)
end
end
class
EagerLoadPolymorphicError
<
ActiveRecordError
#:nodoc:
def
initialize
(
reflection
)
super
(
"Can not eagerly load the polymorphic association
#{
reflection
.
name
.
inspect
}
"
)
...
...
@@ -114,7 +108,6 @@ module Associations # :nodoc:
autoload
:BelongsToAssociation
,
'active_record/associations/belongs_to_association'
autoload
:BelongsToPolymorphicAssociation
,
'active_record/associations/belongs_to_polymorphic_association'
autoload
:HasAndBelongsToManyAssociation
,
'active_record/associations/has_and_belongs_to_many_association'
autoload
:HasManyAssociation
,
'active_record/associations/has_many_association'
autoload
:HasManyThroughAssociation
,
'active_record/associations/has_many_through_association'
autoload
:HasOneAssociation
,
'active_record/associations/has_one_association'
...
...
activerecord/lib/active_record/associations/association.rb
浏览文件 @
5864b9a8
...
...
@@ -13,7 +13,6 @@ module Associations
# BelongsToAssociation
# BelongsToPolymorphicAssociation
# CollectionAssociation
# HasAndBelongsToManyAssociation
# HasManyAssociation
# HasManyThroughAssociation + ThroughAssociation
class
Association
#:nodoc:
...
...
activerecord/lib/active_record/associations/builder/association.rb
浏览文件 @
5864b9a8
...
...
@@ -8,7 +8,6 @@
# - HasOneAssociation
# - CollectionAssociation
# - HasManyAssociation
# - HasAndBelongsToManyAssociation
module
ActiveRecord::Associations::Builder
class
Association
#:nodoc:
...
...
activerecord/lib/active_record/associations/collection_association.rb
浏览文件 @
5864b9a8
...
...
@@ -7,7 +7,6 @@ module Associations
# collections. See the class hierarchy in AssociationProxy.
#
# CollectionAssociation:
# HasAndBelongsToManyAssociation => has_and_belongs_to_many
# HasManyAssociation => has_many
# HasManyThroughAssociation + ThroughAssociation => has_many :through
#
...
...
activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
已删除
100644 → 0
浏览文件 @
957d7ae0
module
ActiveRecord
# = Active Record Has And Belongs To Many Association
module
Associations
class
HasAndBelongsToManyAssociation
<
CollectionAssociation
#:nodoc:
attr_reader
:join_table
def
initialize
(
owner
,
reflection
)
@join_table
=
Arel
::
Table
.
new
(
reflection
.
join_table
)
super
end
def
insert_record
(
record
,
validate
=
true
,
raise
=
false
)
if
record
.
new_record?
if
raise
record
.
save!
(
:validate
=>
validate
)
else
return
unless
record
.
save
(
:validate
=>
validate
)
end
end
stmt
=
join_table
.
compile_insert
(
join_table
[
reflection
.
foreign_key
]
=>
owner
.
id
,
join_table
[
reflection
.
association_foreign_key
]
=>
record
.
id
)
owner
.
class
.
connection
.
insert
stmt
record
end
private
def
count_records
load_target
.
size
end
def
delete_records
(
records
,
method
)
relation
=
join_table
condition
=
relation
[
reflection
.
foreign_key
].
eq
(
owner
.
id
)
unless
records
==
:all
condition
=
condition
.
and
(
relation
[
reflection
.
association_foreign_key
]
.
in
(
records
.
map
{
|
x
|
x
.
id
}.
compact
)
)
end
owner
.
class
.
connection
.
delete
(
relation
.
where
(
condition
).
compile_delete
)
end
def
invertible_for?
(
record
)
false
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录