Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
5f03172f
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,发现更多精彩内容 >>
提交
5f03172f
编写于
1月 05, 2017
作者:
A
Akira Matsuda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Privatize unneededly protected methods in Active Record
上级
5473e390
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
12 addition
and
16 deletion
+12
-16
activerecord/lib/active_record/attribute_methods.rb
activerecord/lib/active_record/attribute_methods.rb
+8
-8
activerecord/lib/active_record/reflection.rb
activerecord/lib/active_record/reflection.rb
+1
-3
activerecord/lib/active_record/relation/delegation.rb
activerecord/lib/active_record/relation/delegation.rb
+1
-1
activerecord/test/cases/migration_test.rb
activerecord/test/cases/migration_test.rb
+1
-1
activerecord/test/models/company.rb
activerecord/test/models/company.rb
+1
-3
未找到文件。
activerecord/lib/active_record/attribute_methods.rb
浏览文件 @
5f03172f
...
...
@@ -394,14 +394,6 @@ def accessed_fields
protected
def
arel_attributes_with_values_for_create
(
attribute_names
)
# :nodoc:
arel_attributes_with_values
(
attributes_for_create
(
attribute_names
))
end
def
arel_attributes_with_values_for_update
(
attribute_names
)
# :nodoc:
arel_attributes_with_values
(
attributes_for_update
(
attribute_names
))
end
def
attribute_method?
(
attr_name
)
# :nodoc:
# We check defined? because Syck calls respond_to? before actually calling initialize.
defined?
(
@attributes
)
&&
@attributes
.
key?
(
attr_name
)
...
...
@@ -409,6 +401,14 @@ def attribute_method?(attr_name) # :nodoc:
private
def
arel_attributes_with_values_for_create
(
attribute_names
)
arel_attributes_with_values
(
attributes_for_create
(
attribute_names
))
end
def
arel_attributes_with_values_for_update
(
attribute_names
)
arel_attributes_with_values
(
attributes_for_update
(
attribute_names
))
end
# Returns a Hash of the Arel::Attributes and attribute values that have been
# typecasted for use in an Arel insert/update method.
def
arel_attributes_with_values
(
attribute_names
)
...
...
activerecord/lib/active_record/reflection.rb
浏览文件 @
5f03172f
...
...
@@ -969,8 +969,7 @@ def collect_join_reflections(seed)
end
end
protected
private
def
actual_source_reflection
# FIXME: this is a horrible name
source_reflection
.
send
(
:actual_source_reflection
)
end
...
...
@@ -981,7 +980,6 @@ def primary_key(klass)
def
inverse_name
;
delegate_reflection
.
send
(
:inverse_name
);
end
private
def
derive_class_name
# get the class_name of the belongs_to association of the through reflection
options
[
:source_type
]
||
source_reflection
.
class_name
...
...
activerecord/lib/active_record/relation/delegation.rb
浏览文件 @
5f03172f
...
...
@@ -113,7 +113,7 @@ def respond_to_missing?(method, include_private = false)
arel
.
respond_to?
(
method
,
include_private
)
end
pr
otected
pr
ivate
def
method_missing
(
method
,
*
args
,
&
block
)
if
@klass
.
respond_to?
(
method
)
...
...
activerecord/test/cases/migration_test.rb
浏览文件 @
5f03172f
...
...
@@ -887,7 +887,7 @@ def test_changing_columns
assert_equal
:datetime
,
column
(
:birthdate
).
type
end
pr
otected
pr
ivate
def
with_bulk_change_table
# Reset columns/indexes cache as we're changing the table
...
...
activerecord/test/models/company.rb
浏览文件 @
5f03172f
...
...
@@ -216,14 +216,12 @@ def self.open
validate
:check_empty_credit_limit
pr
otected
pr
ivate
def
check_empty_credit_limit
errors
.
add
(
"credit_limit"
,
:blank
)
if
credit_limit
.
blank?
end
private
def
private_method
"Sir, yes sir!"
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录