Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
45d0d18b
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,发现更多精彩内容 >>
提交
45d0d18b
编写于
1月 06, 2011
作者:
J
Jon Leighton
提交者:
Aaron Patterson
1月 07, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Not really worth having the HasAssociation module for just a single method
上级
770e6893
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
9 addition
and
21 deletion
+9
-21
activerecord/lib/active_record/associations.rb
activerecord/lib/active_record/associations.rb
+0
-1
activerecord/lib/active_record/associations/association_collection.rb
.../lib/active_record/associations/association_collection.rb
+0
-2
activerecord/lib/active_record/associations/association_proxy.rb
...ecord/lib/active_record/associations/association_proxy.rb
+9
-2
activerecord/lib/active_record/associations/has_association.rb
...erecord/lib/active_record/associations/has_association.rb
+0
-14
activerecord/lib/active_record/associations/has_one_association.rb
...ord/lib/active_record/associations/has_one_association.rb
+0
-2
未找到文件。
activerecord/lib/active_record/associations.rb
浏览文件 @
45d0d18b
...
...
@@ -120,7 +120,6 @@ module Associations # :nodoc:
# So there is no need to eager load them.
autoload
:AssociationCollection
,
'active_record/associations/association_collection'
autoload
:AssociationProxy
,
'active_record/associations/association_proxy'
autoload
:HasAssociation
,
'active_record/associations/has_association'
autoload
:ThroughAssociation
,
'active_record/associations/through_association'
autoload
:BelongsToAssociation
,
'active_record/associations/belongs_to_association'
autoload
:BelongsToPolymorphicAssociation
,
'active_record/associations/belongs_to_polymorphic_association'
...
...
activerecord/lib/active_record/associations/association_collection.rb
浏览文件 @
45d0d18b
...
...
@@ -18,8 +18,6 @@ module Associations
# If you need to work on all current children, new and existing records,
# +load_target+ and the +loaded+ flag are your friends.
class
AssociationCollection
<
AssociationProxy
#:nodoc:
include
HasAssociation
delegate
:group
,
:order
,
:limit
,
:joins
,
:where
,
:preload
,
:eager_load
,
:includes
,
:from
,
:lock
,
:readonly
,
:having
,
:to
=>
:scoped
def
select
(
select
=
nil
)
...
...
activerecord/lib/active_record/associations/association_proxy.rb
浏览文件 @
45d0d18b
...
...
@@ -9,11 +9,11 @@ module Associations
# AssociationProxy
# BelongsToAssociation
# BelongsToPolymorphicAssociation
# AssociationCollection
+ HasAssociation
# AssociationCollection
# HasAndBelongsToManyAssociation
# HasManyAssociation
# HasManyThroughAssociation + ThroughAssociation
# HasOneAssociation
+ HasAssociation
# HasOneAssociation
# HasOneThroughAssociation + ThroughAssociation
#
# Association proxies in Active Record are middlemen between the object that
...
...
@@ -252,6 +252,13 @@ def construct_owner_conditions(table = aliased_table, reflection = @reflection)
table
.
create_and
(
conditions
)
end
# Sets the owner attributes on the given record
def
set_owner_attributes
(
record
)
if
@owner
.
persisted?
construct_owner_attributes
.
each
{
|
key
,
value
|
record
[
key
]
=
value
}
end
end
private
# Forwards any missing method call to the \target.
def
method_missing
(
method
,
*
args
)
...
...
activerecord/lib/active_record/associations/has_association.rb
已删除
100644 → 0
浏览文件 @
770e6893
module
ActiveRecord
module
Associations
# Included in all has_* associations (i.e. everything except belongs_to)
module
HasAssociation
#:nodoc:
protected
# Sets the owner attributes on the given record
def
set_owner_attributes
(
record
)
if
@owner
.
persisted?
construct_owner_attributes
.
each
{
|
key
,
value
|
record
[
key
]
=
value
}
end
end
end
end
end
activerecord/lib/active_record/associations/has_one_association.rb
浏览文件 @
45d0d18b
...
...
@@ -2,8 +2,6 @@ module ActiveRecord
# = Active Record Belongs To Has One Association
module
Associations
class
HasOneAssociation
<
AssociationProxy
#:nodoc:
include
HasAssociation
def
create
(
attrs
=
{})
new_record
do
|
reflection
|
attrs
=
merge_with_conditions
(
attrs
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录