Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
fc35da76
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,发现更多精彩内容 >>
提交
fc35da76
编写于
4月 24, 2019
作者:
R
Ryuta Kamizono
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make association builder methods private
上级
1168dda8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
16 addition
and
1 deletion
+16
-1
activerecord/lib/active_record/associations/builder/association.rb
...ord/lib/active_record/associations/builder/association.rb
+4
-0
activerecord/lib/active_record/associations/builder/belongs_to.rb
...cord/lib/active_record/associations/builder/belongs_to.rb
+3
-0
activerecord/lib/active_record/associations/builder/collection_association.rb
...ive_record/associations/builder/collection_association.rb
+2
-0
activerecord/lib/active_record/associations/builder/has_many.rb
...record/lib/active_record/associations/builder/has_many.rb
+2
-0
activerecord/lib/active_record/associations/builder/has_one.rb
...erecord/lib/active_record/associations/builder/has_one.rb
+2
-0
activerecord/lib/active_record/associations/builder/singular_association.rb
...ctive_record/associations/builder/singular_association.rb
+2
-0
activerecord/test/cases/associations/extension_test.rb
activerecord/test/cases/associations/extension_test.rb
+1
-1
未找到文件。
activerecord/lib/active_record/associations/builder/association.rb
浏览文件 @
fc35da76
...
...
@@ -128,5 +128,9 @@ def self.add_destroy_callbacks(model, reflection)
name
=
reflection
.
name
model
.
before_destroy
lambda
{
|
o
|
o
.
association
(
name
).
handle_dependency
}
end
private_class_method
:build_scope
,
:macro
,
:valid_options
,
:validate_options
,
:define_extensions
,
:define_callbacks
,
:define_accessors
,
:define_readers
,
:define_writers
,
:define_validations
,
:valid_dependent_options
,
:check_dependent_options
,
:add_destroy_callbacks
end
end
activerecord/lib/active_record/associations/builder/belongs_to.rb
浏览文件 @
fc35da76
...
...
@@ -123,5 +123,8 @@ def self.define_validations(model, reflection)
model
.
validates_presence_of
reflection
.
name
,
message: :required
end
end
private_class_method
:macro
,
:valid_options
,
:valid_dependent_options
,
:define_callbacks
,
:define_validations
,
:add_counter_cache_callbacks
,
:add_touch_callbacks
,
:add_default_callbacks
,
:add_destroy_callbacks
end
end
activerecord/lib/active_record/associations/builder/collection_association.rb
浏览文件 @
fc35da76
...
...
@@ -66,5 +66,7 @@ def #{name.to_s.singularize}_ids=(ids)
end
CODE
end
private_class_method
:valid_options
,
:define_callback
,
:define_extensions
,
:define_readers
,
:define_writers
end
end
activerecord/lib/active_record/associations/builder/has_many.rb
浏览文件 @
fc35da76
...
...
@@ -13,5 +13,7 @@ def self.valid_options(options)
def
self
.
valid_dependent_options
[
:destroy
,
:delete_all
,
:nullify
,
:restrict_with_error
,
:restrict_with_exception
]
end
private_class_method
:macro
,
:valid_options
,
:valid_dependent_options
end
end
activerecord/lib/active_record/associations/builder/has_one.rb
浏览文件 @
fc35da76
...
...
@@ -26,5 +26,7 @@ def self.define_validations(model, reflection)
model
.
validates_presence_of
reflection
.
name
,
message: :required
end
end
private_class_method
:macro
,
:valid_options
,
:valid_dependent_options
,
:add_destroy_callbacks
,
:define_validations
end
end
activerecord/lib/active_record/associations/builder/singular_association.rb
浏览文件 @
fc35da76
...
...
@@ -38,5 +38,7 @@ def create_#{name}!(*args, &block)
end
CODE
end
private_class_method
:valid_options
,
:define_accessors
,
:define_constructors
end
end
activerecord/test/cases/associations/extension_test.rb
浏览文件 @
fc35da76
...
...
@@ -89,6 +89,6 @@ def test_association_with_default_scope
private
def
extend!
(
model
)
ActiveRecord
::
Associations
::
Builder
::
HasMany
.
define_extensions
(
model
,
:association_name
)
{
}
ActiveRecord
::
Associations
::
Builder
::
HasMany
.
send
(
:define_extensions
,
model
,
:association_name
)
{
}
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录